pypi仓库
使用私有pypi仓库
1. 搭建私有源
- 在nexus中新加一个pypi(hosted)类型的仓库
- 仓库名称为pypi-releases
- Deployment policy设置为- Allow redeploy
新仓库的访问地址为:http://localhost:8081/repository/pypi-releases/,
账号为nexus的登陆账号。
2. 创建.pypirc
创建文件~/.pypirc 内容:
[distutils]
index-servers = pypi-releases
[pypi-releases]
repository: http://localhost:8081/repository/pypi-releases/
username: admin
password: admin
3. 发布项目到私有仓库
# 发布tar包到仓库
python setup.py sdist upload -r pypi-releases
# 发布wheel包到仓库(推荐)
python setup.py bdist_wheel upload -r pypi-releases
# 清除build目录
python setup.py clean --all
4. 优先级问题
- nexus中可以配置优先级,group中的顺序就是优先级
- whl 的优先级高于tar包的优先级
- 私有源的优先级应该比代理源的优先级高
使用公开仓库
发布到pypi.org 需要安装 twine:
pip install twine
申请账号后,发布软件方法:
python setup.py sdist bdist_wheel
twine check  dist/*
twine upload  dist/*
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号