简体   繁体   English

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

[英]Problems on installing pip (command prompt)

I am new to Python and need to download some modules for a project that I am doing, however, I am getting this error whenever I try to download pip. 我是Python新手,需要为正在执行的项目下载一些模块,但是,每当尝试下载pip时,都会出现此错误。 Would this error be as a result of a firewall? 此错误是由于防火墙引起的吗? If so, is there any way I can get around to installing 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

You need to install OpenSSL , if your OS is Windows. 如果您的操作系统是Windows,则需要安装OpenSSL

get-pip.py tries to extract the SSL certificates from requests in order to verify the pypi.org as a trusted host. get-pip.py尝试从请求中提取SSL证书,以将pypi.org验证为可信主机。 Chances are your python --version installation was not built with SSL support, due to the unavailability of openSSL binaries within your OS. 由于您的操作系统中无法使用openSSL二进制文件,因此可能是您的python --version安装未使用SSL支持构建。 On the second thought, make sure your python binaries and lib are added into your system PATH variable. 再三考虑,确保将python二进制文件和lib添加到系统PATH变量中。

Once OpenSSL installed run py get-pip.py . 安装OpenSSL后,运行py get-pip.py

In order to make sure pip is installed, run pip --version in your command prompt. 为了确保已安装pip --version ,请在命令提示符下运行pip --version

Further, installing other modules using pip behind a corporate firewall can be done using a proxy with your pip install commands. 此外,可以使用带有pip install命令的代理使用公司防火墙后面的pip安装其他模块。

pip install --proxy http://user:password@proxyserver:port <module-name>
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

For this kind of problems is better to use github, copy and paste google and check for github issues. 对于此类问题,最好使用github,复制并粘贴google并检查github问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM