最近不知道是python相关网站不稳定还是被”墙”的原因,python相关的网站几乎是访问不了,想要安装一些新的模块都以失败告终。。没办法,只能用过国内的相关源才能够提供保证,于是,就百度了一下,发现国内采用python开发的大公司一般都有开源的python源,这里列举一下,有需要的拿走。
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
使用方法: pip install 模块名称 -i url(源仓库地址),但是一般情况下,如果源地址使用的不是HTTPS协议,就会报以下的错误:
The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with ‘–trusted-host mirrors.aliyun.com’.
上面的错误信息,已经说的很清楚了,说这个源不是一个受信赖的,安全的源,所以已经进行了忽略。如果想要使用该源,就要保证该源使用了HTTPS协议或者添加–trusted-host 选项,来指定其是受信任的源。
php -i install 模块名称 -i https://pypi.tuna.tsinghua.edu.cn/simple/ ——不会报错