我在私有仓库(blob存储)中有一个包,其中有一个来自pypi仓库的
install_requires
。我以以下方式运行pip:pip install --upgrade mypackage -i https://example.com/ --extra-index-url https://pypi.org/simple/
,但是它失败并显示以下错误:Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/mypackage/
。详细输出如下(已删除部分行)。Looking in indexes: https://example.com/, https://pypi.org/simple/
2 location(s) to search for versions of mypackage:
* https://example.com/mypackage/
* https://pypi.org/simple/mypackage/
Starting new HTTPS connection (1): example.com:443
https://example.com:443 "GET /mypackage/ HTTP/1.1" 304 0
Analyzing links from page https://example.com/mypackage/
Found link https://example.com/mypackage/mypackage-0.0.1-py3-none-any.whl (from https://example.com/mypackage/), version: 0.0.1
Found link https://example.com/mypackage/mypackage-0.0.1.tar.gz (from https://example.com/mypackage/), version: 0.0.1
Getting page https://pypi.org/simple/mypackage/
Looking up "https://pypi.org/simple/mypackage/" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/mypackage/ HTTP/1.1" 404 13
Status code 404 not in [200, 203, 300, 301]
所以它找到了我的软件包,然后就忽略了它。
(我对Python / pip有点陌生,所以可能做了一些傻事)
我在Ubuntu 19.04上运行此操作, 使用以下版本。
(env) ubuntu@ubuntu19:~/staged/packages$ pip --version
pip 18.1 from /home/ubuntu/staged/packages/env/lib/python3.7/site-packages/pip (python 3.7)
(env) ubuntu@ubuntu19:~/staged/packages$ python3 --version
Python 3.7.3
--index-url=https://example.com/mypackage
(而不是--extra-index-url
)吗? - MikeMajarapip install -U pip
修复) - Michael B