Python 3.x 在Windows上使用Pip安装NumPy

Python 3.x 在Windows上使用Pip安装NumPy,python-3.x,numpy,ssl,pip,Python 3.x,Numpy,Ssl,Pip,我下载了Python3.6.1,并预装了Pip。我写这个命令是为了安装numpy C:\Python36-32>python -m pip install numpy 我将此作为输出: 正在收集numpy无法获取URL 当前位置确认时出现问题 ssl证书:[ssl:证书\u验证\u失败]证书 验证失败(_ssl.c:749)-跳过无法找到 满足要求numpy(来自版本:)不匹配 找到numpy的分布 如何解决此问题? PS:我是在Windows 10上执行此操作的,命令提示符以管理员

我下载了Python3.6.1,并预装了Pip。我写这个命令是为了安装numpy

C:\Python36-32>python -m pip install numpy  
我将此作为输出:

正在收集numpy无法获取URL 当前位置确认时出现问题 ssl证书:[ssl:证书\u验证\u失败]证书 验证失败(_ssl.c:749)-跳过无法找到 满足要求numpy(来自版本:)不匹配 找到numpy的分布

如何解决此问题?

PS:我是在Windows 10上执行此操作的,命令提示符以管理员身份运行。

我使用以下命令解决了此问题:

pip install numpy --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org

答案帮助我解决了问题。

我已使用以下命令解决了问题:

python.exe -m pip install numpy
例如:

C:\Users\Suresh\AppData\Local\Programs\Python\Python37>python.exe -m pip install numpy

请确保首先通过选中python exe上的add path(添加路径)框向计算机添加python路径。然后在命令提示符下运行
pip install numpy

在我的情况下(Dockerfile或Linux),我们希望从requirement*.txt文件安装pip模块,已锁定文件中定义的模块版本,并从内部工件服务器获取(而非联机,即pypi.org)

Ex:requirements.txt文件

为了解决这个问题:我必须使用
NO\u PROXY=
作为环境变量

比方说,如果您的人工服务器是:my artifactory.company.local或my artifactory.company.com,那么我们需要确保的是,
没有代理
变量在其值中列出主机名的“”部分

i、 e.为了 我的人工制品。company.com或我的人工制品。company.local,内部价值

代理变量中不能有:
、.company.com、.company.local、

示例导出的变量(在命令行$prompt处):

export NO_PROXY=localhost,127.0.0.1169.254.169.254169.254.169.123,.somecompany.com,.company.com,.company.local,pki.company.com,s3-us-gov-west-1.amazonaws.com,s3-fips-us-gov-west-1.amazonaws.com,rds.amazonaws.com,10.201.12.244,10.201.44.62,10.201.32.261

====

如果使用的是
Dockerfile
,请确保正确设置了ARG/ENV变量。 ARG在生成时使用(可以在命令行中使用--build ARG选项被覆盖,并发送到
docker build-t标记。
在其中搜索当前目录中的docker文件并创建映像。ENV在运行时使用(
docker run
),也可以被覆盖

示例Dockerfile是:

FROM python:3.7

MAINTAINER giga.sangal@company.com

ARG PYTHONBUFFERED=0
ARG HTTPS_PROXY=http://proxy.ext.company.com:80
ARG HTTP_PROXY=http://proxy.ext.company.com:80
ARG NO_PROXY=localhost,127.0.0.1,169.254.169.254,.company.com,.company.local,pki.company.com,s3-us-gov-west-1.amazonaws.com,s3-fips-us-gov-west-1.amazonaws.com,rds.amazonaws.com

ENV PYTHONBUFFERED=${PYTHONBUFFERED}
ENV HTTPS_PROXY=${HTTPS_PROXY}
ENV HTTP_PROXY=${HTTP_PROXY}
ENV NO_PROXY=${NO_PROXY}

# If there are 3 requirements files in source control, I'm copy all for pip install, you don't have to. Use what modules you want / file you want.    
RUN mkdir -p code
COPY requirements.txt /code
COPY requirements-test.txt /code
COPY requirements-dev.txt /code

WORKDIR /code

# You can fetch from pypi.org but in my case, this was a security issue.
# RUN pip install --trusted-host pypi.org -r requirements.txt

RUN pip install --no-cache-dir --trusted-host my-artifactory.company.local -r requirements.txt -r requirements-test.txt -r requirements-dev.txt --index-url http://my-artifactory.company.local:8081/artifactory/api/pypi/pypi-local-deps/simple --disable-pip-version-check
解决我的问题的主线是使用NO_代理(如上所列)

cmd行或Dockerfile中应用上述NO_代理后,任何与pip模块相关的问题未找到,或模块版本未找到,或任何SSL错误
SSLError(SSLCertVerificationError
类似错误)消失:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1091)'))': /simple/requests/


pip install numpy
是我运行的命令,我对该命令也得到了相同的结果。如果是我,我不会使用最新版本的python。如果可能,请使用3.5/3.4,它的语法相同,但兼容性更强。答案与问题无关。
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1091)'))': /simple/requests/
ERROR: Could not find a version that satisfies the requirement requests
ERROR: No matching distribution found for requests
ERROR: Could not find a version that satisfies the requirement numpy==1.16.2
ERROR: No matching distribution found for numpy==1.16.2