创建pypi本地仓库
hosted – 宿主仓库 ,用户可以 deploy 到 hosted 中,也可以手工上传构件到 hosted 里,在 central repository 是获取不到的,就需要手工上传到hosted里?
?group – 仓库组 ,将上述多个仓库聚合,对用户暴露统一的地址
将刚创建的pypi-hosted仓库添加进去
?上传pypi包
批量上传,使用python的twine包
pip install twine twine upload --repository-url? 仓库地址 -u 用户名 -p 密码??pypi包所在的路径 twine upload --repository-url http://192.168.0.99:8081/repository/pypi-host/ -u admin -p helloword /opt/python-package/*
pip使用本地源进行安装
[root@localhost bin]# pip install requests -i http://10.4.7.23:8081/repository/pypi-group/simple --trusted-host 10.4.7.23 ?//-i 指定pypi源? Collecting requests ? Downloading http://10.4.7.23:8081/repository/pypi-group/packages/requests/2.25.1/requests-2.25.1-py2.py3-none-any.whl (61kB) ? ? 100% |████████████████████████████████| 61kB 6.3MB/s? Collecting certifi>=2017.4.17 (from requests) ? Downloading http://10.4.7.23:8081/repository/pypi-group/packages/certifi/2020.12.5/certifi-2020.12.5-py2.py3-none-any.whl (147kB) ?
?
?
|