我如何将 pip search 与我自己的 nexus pypi repo 一起使用?

how can i use pip search with my own nexus pypi repo?

我在局域网中部署了一个 nexus repo sys,并在其上配置了一个 PyPI repo。我可以使用 pip install 通过我的私人镜像安装包。但是我不能使用 pip search.

这是我的pip.ini

[global]
index-url = http://nexus.repo.com/repository/PyPI/simple
index = http://nexus.repo.com/repository/PyPI/pypi
trusted-host = nexus.repo.com

当我使用 pip search 时 returns:

C:\Users\user>pip search redis
HTTP error 404 while getting http://nexus.repo.com/repository/PyPI/pypi
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\search.py", line 45, in run pypi_hits = self.search(query, options)
File "c:\python27\lib\site-packages\pip\commands\search.py", line 62, in search hits = pypi.search({'name': query, 'summary': query}, 'or')
File "c:\python27\lib\xmlrpclib.py", line 1243, in call return self.__send(self.__name, args)
File "c:\python27\lib\xmlrpclib.py", line 1602, in __request verbose=self.__verbose
File "c:\python27\lib\site-packages\pip\download.py", line 776, in request response.raise_for_status()
File "c:\python27\lib\site-packages\pip_vendor\requests\models.py", line 862, in raise_for_status raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url:http://nexus.repo.com/repository/PyPI/pypi
C:\Users\user>

我在谷歌上搜索了又搜索,但到目前为止一无所获。 所以我在这里,希望其他人可以指导我解决这个问题。 非常感谢。

试试这个: pip search redis -i http://nexus.repo.com/repository/PyPI/pypi -vvv --trusted-host nexus.repo.com

我遇到了同样的问题,发现我基本上是在搜索 /simple url,而不是 /pypi(/simple 仅适用于 pip 安装)

我的问题是我在设置代理存储库时使用简单的 URL https://pypi.org/simple/ 作为 Remote Storage 参数而不是 https://pypi.org/.

看起来这个功能 was deprecated 用于代理存储库。

"pip search" command is deprecated and doesn't work with a proxy repository, but you can still search for packages in hosted repositories.