python安装nexus私服包的两种方式

python安装nexus私服包的两种方式,第1张

用命令行安装

使用如下命令可在命令行直接安装私服包

pip install packageName -i [私服仓库地址] --trusted-host [私服域名/ip]
示例
pip install ccr_pylogger -i http://192.168.1.201:9527/repository/pypi-group/simple  --trusted-host 192.168.1.201
用requirments.txt文件安装

通常情况下,公司管理python工程会将依赖包写在requirments.txt文件中,那如何将公司内部已经推送到nexus私服上的公共包也通过requirments.txt文件安装呢?
使用如下办法可已经解决。

requirements.txt示例

# pip源中的依赖包
Twisted~=22.1.0
pymongo==3.11.2
redis~=4.1.4

# nexus私服中的依赖包
--extra-index-url http://[domain]/repository/pypi-group/simple --trusted-host [domain]
ccr_pylogger==0.0.5
ccr_pymongo==0.0.5

有了以上requirements.txt文件就可以配合shell脚本统一初始化工程了~

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/734865.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-27
下一篇 2022-04-27

发表评论

登录后才能评论

评论列表(0条)

保存