python中pip的使用和修改下载源的方法

时间:2022-09-27 14:47:32

基本命令

显示版本信息

?
1
pip -V

安装指定包

?
1
2
pip install <packages>
pip install -i 'host' <packages> 指定下载源

卸载指定包

?
1
pip uninstall <packages>

列出已安装的包

?
1
pip list

显示有关已安装包的信息

?
1
pip show <packages>

查找指定包

?
1
pip search

修改下载源

Linux

?
1
vim ~/.pip/pip.conf #编辑用户目录下隐藏的配置文件,没有的话生成一个

格式如下:

?
1
2
3
4
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

window的修改方法同Linux类似,在用户目录编辑pip.conf即可,如C:\Users\用户名\AppData\Local\pip

国内源

?
1
2
3
4
5
6
7
8
9
10
11
清华:https://pypi.tuna.tsinghua.edu.cn/simple
 
阿里云:http://mirrors.aliyun.com/pypi/simple/
 
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
 
华中理工大学:http://pypi.hustunique.com/
 
山东理工大学:http://pypi.sdutlinux.org/
 
豆瓣:http://pypi.douban.com/simple/

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:https://segmentfault.com/a/1190000019690603