pip install換源

pypi換源總結

由於pypi源默認爲國外源,經常被牆導致不可用,所以安裝軟件時pip源最好更換爲國內資源

常用國內源:

豆瓣:http://pypi.douban.com/simple/
清華:https://pypi.tuna.tsinghua.edu.cn/simple

使用方法

直接使用:
在安裝軟件時使用帶源地址的安裝方法,以安裝keras爲例輸入如下命令:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple keras

更換python安裝目錄下的源地址:將..\Lib\site-packages\pip\models\index.py文件中的PyPI值修改爲你希望的國源鏈接。如將其修改爲清華源:

註釋掉:PyPI = Index(‘https://pypi.python.org/‘)
修改源:PyPI = Index(‘https://pypi.tuna.tsinghua.edu.cn/simple‘)

修改後安裝keras命令:pip install keras

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章