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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

linda公馆   2021-03-03 我要评论
想了解pip install命令安装扩展库整理的相关内容吗,linda公馆在本文为您仔细讲解pip install命令的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:python中pip,install命令,python中pip命令,下面大家一起来学习吧。

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

命令格式:

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

常用国内镜像地址:

清华大学:http://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:https://mirrors.aliyun.com/pypi/simple/
豆瓣网:http://pypi.douban.com/simple/
中国科技大学:http://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'.”安装错误问题:


在这里插入图片描述

解决办法:

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


在这里插入图片描述

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


在这里插入图片描述

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

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


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

安装成功。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们