windows 环境下,python 安装好后,最好将 pip 源换成国内的,同时添加一下信任主机。避免形如: Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.tuna.tsinghua.edu.cn’, port=44 3): Max retries exceeded with url: /simple/requests/ (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local iss uer certificate (_ssl.c:1123)’))) - skipping ERROR: Could not find a version that satisfies the requirement requests (from versions: none) ERROR: No matching distribution found for requests 的错误出现。
- 首先执行
pip config set global.extra-index-url http://mirrors.aliyun.com/pypi/simple
- 此时可以看到 pip 自动生成了一个文件,提示:Writing to C:\Users\xxxxxx\AppData\Roaming\pip\pip.ini
- 打开该文件,直接将下列内容覆盖进去:
[global]
index-url = http://mirrors.aliyun.com/pypi/simple
extra-index-url =
http://pypi.douban.com/simple
https://pypi.tuna.tsinghua.edu.cn/simple
http://pypi.mirrors.ustc.edu.cn/simple
http://pypi.hustunique.com
[install]
trusted-host =
mirrors.aliyun.com
pypi.douban.com
pypi.tuna.tsinghua.edu.cn
pypi.mirrors.ustc.edu.cn
mirrors.ustc.edu.cn
mirrors.bfsu.edu.cn
pypi.hustunique.com
- 保存,完成
|