最近由于工作需要,需要在windows中安装python和相关库文件,但是电脑接入了区域内网,使用了统一网络代理。在cmd中安装python3.6较为顺利,但安装numpy和matplotlib时一直报错:
ERROR: Could not find a version that satisfied the requirements numpy
ERROR: No matching distribution found for numpy.
解决办法如下:
1、转接proxy权限
管理员身份打开cmd,设置
set http_proxy = http://username:password@example.com:8080
set https_proxy = http://username:password@example.com:8080
注意,password不能出现特殊字符,如“!@#¥%-+&* ”等,如果出现,需要用ASCII码进行替代,参考 https://blog.csdn.net/pcyph/article/details/45010609
然后使用如下命令检验是否转接成功
curl http://google.com
curl https://google.com
如果验证https时出错,可以加--ssl-no-revoke检查
2、安装
python -m pip install numpy --user --trusted-host pypi.org --trusted-host files
python -m pip install matplotlib --user --trusted-host pypi.org --trusted-host files
安装成功。
测试参考: