我是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
答案 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问题。