由于 pip 默认使用的是官方的源,国内下载速度极慢。只需将默认源改为 douban,就可以让下载速度飞起来。方法如下:
- 将文件
Python或Anaconda安装路径\Lib\site-packages\pip\_internal\models\index.py
中的
PyPI = PackageIndex(
'https://pypi.org/', file_storage_domain='files.pythonhosted.org'
)
改为
PyPI = PackageIndex(
'https://pypi.douban.com/', file_storage_domain='files.pythonhosted.org'
)
即可。