脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - pip install命令安装扩展库整理

pip install命令安装扩展库整理

2021-09-13 00:11linda公馆 Python

这篇文章主要介绍了pip install命令安装扩展库整理,文中代码和图文讲解的很详细,有需要的同学可以参考下

pip install命令用于安装扩展库,由于安装扩展库需要从国外网站下载,速度较慢,可以使用-i选项设置临时使用国内的镜像网站。

命令格式:

pip install -i 镜像地址 包名
例如:
pip install -i http://pypi.douban.com/simple/ django

常用国内镜像地址:

清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:https://mirrors.aliyun.com/pypi/simple/
豆瓣网:https://pypi.douban.com/simple/
中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/

使用pip install命令时,如果出现“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'.”安装错误问题:

pip install命令安装扩展库整理

解决办法:

(1)可以使用参数–trusted-host指定可信任的主机
pip install -i http://pypi.douban.com/simple django --trusted-host=pypi.douban.com

pip install命令安装扩展库整理

安装成功后,可以用pip list查看包列表验证一下。

pip install命令安装扩展库整理

(2)不用参数–trusted-host,把http换成https。
pip install -i https://pypi.douban.com/simple django

试一下,先删除已安装的django包
pip uninstall django

pip install命令安装扩展库整理
pip install命令安装扩展库整理

安装成功。

到此这篇关于pip install命令安装扩展库整理的文章就介绍到这了,更多相关pip install命令内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/qq_40078436/article/details/114238908

延伸 · 阅读

精彩推荐