Python中怎么修改pip源,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。
pip-修改國內鏡像源
Oct 10, 2016 | 16 Hits
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
注意事項:
http://mirrors.aliyun.com/pypi/simple/ 中的simple目錄必須有。
–no-cache-dir 重新下載安裝包,而不是使用緩存包。
trusted-host = mirrors.aliyun.com 一定要加上這行,否則會報錯。
pip國內鏡像源
阿里云 http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple
Python官方 https://pypi.python.org/simple/
v2ex http://pypi.v2ex.com/simple/
中國科學院 http://pypi.mirrors.opencas.cn/simple/
清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/
報錯匯總
報錯內容
pip install mysql-python
Collecting mysql-python
The repository located at pypi.douban.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 pypi.douban.com'.
Could not find a version that satisfies the requirement mysql-python (from versions: )
No matching distribution found for mysql-python
解決辦法
編輯 vim .pip/pip.conf
[install]
trusted-host = mirrors.aliyun.com
看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注億速云行業資訊頻道,感謝您對億速云的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。