pip 源和相关命令笔记

pip 相关命令

pip freeze >requirements.txt      # 导出依赖包列表
pip install -r requirements.txt   # 从依赖包列表中安装
pip install -c constraints.txt    # 确保当前环境软件包的版本(并不确保安装)

pip list              # 查询当前环境安装的所有软件包
pip search pkg        # 查询 pypi 上含有某名字的包
pip list --outdated   # 查询当前环境中可升级的包
pip show pkg          # 查询一个包的详细内容

限定版本进行安装


pip install pkg==2.1.2  # 所安装的包的版本为 2.1.2  
pip install pkg>=2.1.2  # 所安装的包必须大于等于 2.1.2
pip install pkg<=2.1.2  # 所安装的包必须小于等于 2.1.2

指定代理服务器安装


& C:/Users/[user]/AppData/Local/Programs/Python/Python312/python.exe -m pip --proxy http://usr:pswd@ip:port install pkgname


win永久换源方法


手动建目录  C:\Users\wangjiangjun.fnst\AppData\Roaming\pip\pip.ini

或者 设置一下可自动生成
pip config set global.index-url  http://mirrors.aliyun.com/pypi/simple/ 

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

阿里云
https://ai-foundation-chat-dot-ai-web-ui-prod.an.r.appspot.com/
中国科技大学
https://pypi.mirrors.ustc.edu.cn/simple/ 
豆瓣(douban)
https://pypi.douban.com/simple/ 
清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/ 
中国科学技术大学
https://pypi.mirrors.ustc.edu.cn/simple/
官方源
https://pypi.python.org/simple

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值