欢迎来到代码驿站!

Python代码

当前位置:首页 > 软件编程 > Python代码

pip install命令安装扩展库整理

时间:2021-09-15 10:43:08|栏目:Python代码|点击:

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 ‘?Ctrusted-host pypi.douban.com'.”安装错误问题:


在这里插入图片描述

解决办法:

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


在这里插入图片描述

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


在这里插入图片描述

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

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


在这里插入图片描述
在这里插入图片描述

安装成功。

上一篇:python 字典中取值的两种方法小结

栏    目:Python代码

下一篇:在Python的Django框架中更新数据库数据的方法

本文标题:pip install命令安装扩展库整理

本文地址:http://www.codeinn.net/misctech/175074.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有