欢迎光临散文网 会员登陆 & 注册

Python学习笔记:(2-3)pip

2021-02-21 19:45 作者:僚机Wingplane  | 我要投稿

pip下载

python在下载后会默认安装pip,如果没有安装则在CMD(命令提示符)中进入Python安装目录下的Scripts路径,执行

easy_install.exe pip

安装pip

然后输入pip install + 包名 下载包,下面以opencv为例

pip install opencv-python

安装完成

pip换源

在安装的时候如果因为下载速度慢可以尝试更换国内的镜像源

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

在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

现在再下载速度会有明显提升

pip卸载包

在CMD中输入pip uninstall + 包名 下载包

以opencv为例

pip uninstall opencv-python

参考文章:

python实现opencv学习一:安装、环境配置、工具    https://blog.csdn.net/u011321546/article/details/79499598

python - pip换源,更换pip源到国内镜像    https://blog.csdn.net/xuezhangjun0121/article/details/81664260

pip的安装,更新,卸载模块以及使用方法 python    https://blog.csdn.net/Winterto1990/article/details/47455405


Python学习笔记:(2-3)pip的评论 (共 条)

分享到微博请遵守国家法律