当使用 virtualenvwrapper 创建了一个新的环境时, 使用 pip 安装模块报错, pip 版本过低又无法自动升级

安装错误

# 创建并切换到新环境
$ mkvirtualenv aliyun_image_search
$ workon aliyun_image_search

# 安装模块
$ python -m pip install aliyun-python-sdk-core
Collecting aliyun-python-sdk-core
  Could not fetch URL https://pypi.python.org/simple/aliyun-python-sdk-core/: There was a problem confirming the ssl cer
tificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) - skipping
  Could not find a version that satisfies the requirement aliyun-python-sdk-core (from versions: )
No matching distribution found for aliyun-python-sdk-core
# 查看 pip 版本
$ python -m pip --version
pip 9.0.1 from /Users/xuyinglong/.virtualenvs/aliyun_image_search/lib/python3.5/site-packages/pip-9.0.1-py3.5.egg (pytho
n 3.5)

# pip 自动升级也是同样的错误
$ python -m pip install --upgrade pip 
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1
_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) - skipping
Requirement already up-to-date: pip in /Users/xuyinglong/.virtualenvs/aliyun_image_search/lib/python3.5/site-packages/pi
p-9.0.1-py3.5.egg

更新pip

# 安装最新的pip
$ curl https://bootstrap.pypa.io/get-pip.py | python

成功安装之后, pip 就可以正常使用了


参考:



blog comments powered by Disqus

Published

11 August 2019

Tags