【Python】PIP命令以及镜像源使用

PIP安装库

pip安装库

pip install tensorflow

pip安装指定版本的库

pip install tensorflow==1.15.0

PIP参数

pip通过镜像安装(-i)

pip install tensorflow==1.15.0 -i https://mirrors.aliyun.com/pypi/simple
pip install tensorflow-io==1.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

pip通过文件安装(-r)

pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple

示例requirements.txt(可以带版本号):

requests
sqlalchemy==1.3.20
peewee
tensorflow==1.15.0

PIP更新

更新

python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple

更新到指定版本

python -m pip install --upgrade pip==20.3.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

PIP设置(镜像源设置)

设置

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

取消设置

pip config unset global.index-url

查看设置列表

pip config list
地址
腾讯http://mirrors.tencentyun.com/pypi/simple
阿里https://mirrors.aliyun.com/pypi/simple
豆瓣https://pypi.douban.com/simple
中科大https://pypi.mirrors.ustc.edu.cn/simple/
清华https://pypi.tuna.tsinghua.edu.cn/simple

查看版本

pip库列表

pip list

pip看看库信息

pip show <库名>

常见问题

报错:This is an issue with the package mentioned above, not pip.
可以尝试降低库版本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值