linux搭建本地python源

需要用到bandersnatch工具能与python包同步

1.1 python2.7

pip install bandersnatch==1.11

1.2如果是python3

pip install bandersnatch

生成配置文件

执行:bandersnatch mirror
更改配置:vim /etc/bandersnatch.conf

[mirror]
; The directory where the mirror data will be stored.
directory = /media/ubuntu/0B2E193B0B2E193B/python36env/srv/pypi
*;文件存储路径*
; Save JSON metadata into the web tree:
; URL/pypi/PKG_NAME/json (Symlink) -> URL/json/PKG_NAME
json = false

; The PyPI server which will be mirrored.
; master = https://test.python.org
; scheme for PyPI server MUST be https
master = https://pypi.org
同步python源,执行:

bandersnatch -c /etc/bandersnatch.conf mirror
安装 nginx
apt-get install nginx
配置nginx服务器
在 /etc/nginx/sites-available/default/nginx.conf
启动nginx服务器
/etc/init.d/nginx start
打开网页查看是否正常http://127.0.0.1/simple/
更改服务器配置pip的地址
cat ~/.pip/pip.conf
[global]
trusted-host=172.28.88.102
index-url=http://172.28.88.102/simple

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值