简体   繁体   English

升级到 18.1 后无法将 --extra-index-url 与 pip 一起使用

[英]Unable to use --extra-index-url with pip after upgrading to 18.1

I've created my own python wheel package and hosted it locally so that I can install it with pip using the --extra-index-url flag like so:我已经创建了自己的 python wheel 包并将其托管在本地,以便我可以使用 --extra-index-url 标志使用 pip 安装它,如下所示:

pip install --extra-index-url http://10.0.0.100:5000/ MyPackage --trusted-host 10.0.0.100

I have several dependencies that get installed and with pip version 9.0.1 this seemed to work fine;我安装了几个依赖项,使用 pip 版本 9.0.1 这似乎工作正常; it would initially look for the dependencies at the supplied index, would get a 404 error because I am only hosting my own package, but then would try looking for it at the default index url, https://pypi.org/simple .它最初会在提供的索引中查找依赖项,会得到 404 错误,因为我只托管我自己的包,但随后会尝试在默认索引 url 中查找它, https://pypi.org/simple

After upgrading to pip 18.1 however it throws an exception on the initial 404 error and cancels the entire install:升级到 pip 18.1 后,它会在初始 404 错误上引发异常并取消整个安装:

HTTPError: 404 Client Error: NOT FOUND for url: http://10.0.0.100:5000/urllib3/

Am I doing something wrong or is this the intended functionality?我做错了什么还是这是预期的功能?

Ultimately I want to be able to host a single package locally, use pip to download and install it but have any dependencies pulled from the default pip repo.最终,我希望能够在本地托管单个包,使用 pip 下载并安装它,但从默认的 pip 存储库中提取任何依赖项。 Is there another way to accomplish this?有没有另一种方法来实现这一点? Everything I have read says that --extra-index-url is the way to accomplish this but it no longer seems to be working...我读过的所有内容都说 --extra-index-url 是实现此目的的方法,但它似乎不再起作用...

UPDATE:更新:

I tried to replicate this on another system and encountered the same issue using pip version 9.0.1 so it seems that the upgrade wasn't the root cause.我尝试在另一个系统上复制它并使用 pip 版本 9.0.1 遇到了同样的问题,所以升级似乎不是根本原因。 Strangely, after upgrading to 18.1 on this other system it worked fine...奇怪的是,在另一个系统上升级到 18.1 后,它运行良好......

Ultimately I was able to get the original system working by just uninstalling and reinstalling pip with easy_install.最终,我能够通过使用 easy_install 卸载并重新安装 pip 来使原始系统正常工作。 I am still not sure what the underlying issue might be though...我仍然不确定潜在的问题可能是什么......

To answer the comment, for this I was using Flask-AutoIndex to host the contents of a folder.为了回答评论,为此我使用 Flask-AutoIndex 来托管文件夹的内容。 Not as simple as your solution I suppose but gets the job done:不像你的解决方案那么简单,但可以完成工作:

from flask import Flask
from flask_autoindex import AutoIndex

app = Flask(__name__)
AutoIndex(app, browse_root='packages')

if __name__ == '__main__':
    app.run('0.0.0.0', debug=True, port=5005, threaded=True)

I've just had the same problem when trying to install another lib with pip 18.1.我在尝试使用 pip 18.1 安装另一个库时遇到了同样的问题。 Upgrading to pip 19.2.3 solved the issue.升级到 pip 19.2.3 解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM