有关安装pip的问题(命令提示符)

时间:2019-08-13 07:06:18

标签: python pip command-prompt

我是Python的新手,需要为我正在执行的项目下载一些模块,但是,每当尝试下载pip时,都会出现此错误。此错误是由于防火墙引起的吗?如果是这样,我有什么办法可以安装pip?

U:\>Py get-pip.py
WARNING: pip is configured with locations that require TLS/SSL, however 
the ssl module in Python is not available.
Collecting pip
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError("Can't connect to HTTPS 
URL 
because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError("Can't connect to HTTPS 
URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError("Can't connect to HTTPS 
URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError("Can't connect to HTTPS 
URL 
 because the SSL module is not available.")': /simple/pip/
 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, 
 status=None)) after connection broken by 'SSLError("Can't connect to 
HTTPS 
  URL because the SSL module is not available.")': /simple/pip/
  Could not fetch URL https://pypi.org/simple/pip/: There was a problem 
 confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', 
 port=443): Max retries exceeded with url: /simple/pip/ (Caused by 
 SSLError("Can't connect to HTTPS URL because the SSL module is not 
 available.")) - skipping
 ERROR: Could not find a version that satisfies the requirement pip (from 
 versions: none)
 ERROR: No matching distribution found for pip
 WARNING: pip is configured with locations that require TLS/SSL, however 
 the 
ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem 
confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', 
port=443): Max retries exceeded with url: /simple/pip/ (Caused by 
SSLError("Can't connect to HTTPS URL because the SSL module is not 
available.")) - skipping

2 个答案:

答案 0 :(得分:0)

如果您的操作系统是Windows,则需要安装OpenSSL

get-pip.py尝试从请求中提取SSL证书,以将pypi.org验证为可信主机。您的python --version安装很有可能不是由于SSL支持而构建的,因为您的操作系统中没有openSSL二进制文件。 再三考虑,确保将python二进制文件和lib添加到系统PATH变量中。

一旦安装了OpenSSL,运行py get-pip.py

为了确保已安装pip,请在命令提示符下运行pip --version

此外,可以使用pip install命令using a proxy在公司防火墙后面使用pip安装其他模块。

pip install --proxy http://user:password@proxyserver:port <module-name>

答案 1 :(得分:-1)

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

对于这种问题,最好使用github,复制并粘贴google并检查github问题。