首页 > 解决方案 > 在内部 pypi 索引上找不到包

问题描述

我有一个mypackage托管在内部 pypi 存储库上的私有包。当我尝试安装它时,我得到

$ pip install mypackage

Looking in indexes: https://pypi.org/simple, https://internal.com/repository/pipy-internal/
ERROR: Could not find a version that satisfies the requirement mypackage (from versions: none)
ERROR: No matching distribution found for mypackage

我可以在内部连接上看到包。这是文件夹结构

| internal.com/repository/pipy-internal/
| -- mypackage
| ---- 0.1.0
| ------- mypackage-0.1.0-py3-none-any.whl

这是我的~/.config/pip/pip.conf(我在 ubuntu 18.04 上)

[global]
extra-index-url = https://internal.com/repository/pipy-internal/
trusted-host = pypi.org
               internal.com

内部仓库需要我存储的登录凭据~/.netrc

machine internal.com
   login myuser
   password mypassword

安装其他 python 包(来自 pypi.org)工作正常。

编辑

当我运行pip installwith时,--verbose我看到 pip 需要直接在目录下的文件internal.com/repository/pipy-internal/mypackage/(可能是.whl文件)。但就我而言,还有一个额外的版本文件夹 ( 0.1.0)。这个文件夹结构是由 twine 创建的

twine upload -r nexus --config-file $HOME/.pypirc  dist/*.whl
 Uploading distributions to https://internal.com/repository/pipy-internal/
 Uploading mypackage-0.1.0-py3-none-any.whl
 100%|██████████| 4.05k/4.05k [00:00<00:00, 12.2kB/s]

标签: pythonpypi

解决方案


推荐阅读