我已经在 aws 云上配置了 Nexus-OSS-3.14 私有 Python 工件服务器。我想在我的私人存储库服务器上维护我所有与项目相关的 Python 包。
我在本地 Linux 机器上下载了所有 Python 包,我想将所有 Python 包上传到私有 Python 工件服务器。
我试过 curl put request 但我没有上传,需要你的帮助来完成这个。
我试过 curl put 请求:
curl -v -u admin:admin --upload-file boto3-1.9.76-py2.py3-none-any.whl https://artifact.example.com/repository/ASAP-Python-2.7-Hosted/
Run Code Online (Sandbox Code Playgroud)
当我使用该命令并得到 404 响应时。
Pip(纱线)供下载。缠绕用于上传。配置:
小心尾随斜杠!
pip config edit [--editor [nano|code|...]] [--global|--user]用于编辑配置
[global]
index = https://nexus.your.domain/repository/pypi/pypi
index-url = https://nexus.your.domain/repository/pypi/simple
Run Code Online (Sandbox Code Playgroud)
或者设置环境变量。Dockerfile 例如:
ENV \
PIP_INDEX=https://nexus.your.domain/repository/pypi/pypi \
PIP_INDEX_URL=https://nexus.your.domain/repository/pypi/simple
Run Code Online (Sandbox Code Playgroud)
或者使用命令行参数pip install --index
编辑.pypirc:
[distutils]
index-servers =
pypi
[pypi]
repository: https://nexus.your.domain/repository/pypi-hosted/
username: nexususername
password: nexuspassword
Run Code Online (Sandbox Code Playgroud)
或者环境
ENV \
TWINE_REPOSITORY_URL=https://nexus.your.domain/repository/pypi-hosted/ \
TWINE_USERNAME=nexususername \
TWINE_PASSWORD=nexuspassword
Run Code Online (Sandbox Code Playgroud)
或者命令行
twine upload --repository-url
我认为推荐的方法是使用twine,这样的事情应该有效:
pip install twine
twine upload --repository https://artifact.example.com/repository/ASAP-Python-2.7-Hosted/ boto3-1.9.76-py2.py3-none-any.whl
Run Code Online (Sandbox Code Playgroud)
它应该询问您的用户名和密码。为了让生活更轻松,您可以$HOME/.pypirc使用 URL、用户名和密码创建文件
[nexus]
repository: https://artifact.example.com/repository/ASAP-Python-2.7-Hosted/
username: admin
password: admin
Run Code Online (Sandbox Code Playgroud)
然后当你打电话时twine,这样做:
twine upload --repository nexus boto3-1.9.76-py2.py3-none-any.whl
Run Code Online (Sandbox Code Playgroud)
这不是一个硬性要求,但是如果您在多用户系统上并且您已经在文件中输入了密码,您可能应该这样做
chmod 600 $HOME/.pypirc
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14411 次 |
| 最近记录: |