pip install命令用于安裝擴(kuò)展庫,由于安裝擴(kuò)展庫需要從國外網(wǎng)站下載,速度較慢,可以使用-i選項(xiàng)設(shè)置臨時使用國內(nèi)的鏡像網(wǎng)站。
命令格式:
pip install -i 鏡像地址 包名
例如:
pip install -i http://pypi.douban.com/simple/ django
常用國內(nèi)鏡像地址:
清華大學(xué):https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:https://mirrors.aliyun.com/pypi/simple/
豆瓣網(wǎng):https://pypi.douban.com/simple/
中國科技大學(xué):https://pypi.mirrors.ustc.edu.cn/simple/
使用pip install命令時,如果出現(xiàn)“WARNING: 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 we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with ‘–trusted-host pypi.douban.com'.”安裝錯誤問題:
解決辦法:
(1)可以使用參數(shù)–trusted-host指定可信任的主機(jī)
pip install -i http://pypi.douban.com/simple django --trusted-host=pypi.douban.com
安裝成功后,可以用pip list查看包列表驗(yàn)證一下。
(2)不用參數(shù)–trusted-host,把http換成https。
pip install -i https://pypi.douban.com/simple django
試一下,先刪除已安裝的django包
pip uninstall django
安裝成功。
到此這篇關(guān)于pip install命令安裝擴(kuò)展庫整理的文章就介紹到這了,更多相關(guān)pip install命令內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
您可能感興趣的文章:- 用pip給python安裝matplotlib庫的詳細(xì)教程
- pip 20.3 新版本發(fā)布!即將拋棄 Python 2.x(推薦)
- python subprocess pipe 實(shí)時輸出日志的操作
- Python更改pip鏡像源的方法示例
- Python離線安裝各種庫及pip的方法