2

I'm trying to distribute a package by registering it to PyPI with an external download_url pointing to a bitbucket zip file. The setup file used can be found here. I package it using

$ python setup.py sdist register

However, pip or easy_install cannot find the package

$ pip install PyBlockWork
Downloading/unpacking PyBlockWork
  Could not find any downloads that satisfy the requirement PyBlockWork
Cleaning up...
No distributions at all found for PyBlockWork
Storing complete log in C:\Users\oreichri\pip\pip.log

The pip log file looks like this:

------------------------------------------------------------
C:\Python27\Scripts\pip-script.py run on 10/30/13 14:17:36
Downloading/unpacking PyBlockWork

  Getting page https://pypi.python.org/simple/PyBlockWork/
  URLs to search for versions for PyBlockWork:
  * https://pypi.python.org/simple/PyBlockWork/
  Analyzing links from page https://pypi.python.org/simple/PyBlockWork/
  Could not find any downloads that satisfy the requirement PyBlockWork

Cleaning up...

  Removing temporary dir c:\users\oreichri\appdata\local\temp\pip_build_oreichri...
No distributions at all found for PyBlockWork

Exception information:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecommand.py", line 134, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\commands\install.py", line 236, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py", line 1085, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\index.py", line 265, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for PyBlockWork

The download url is available and functional on https://pypi.python.org/pypi/PyBlockWork/0.1.0 but pip seems only to look at https://pypi.python.org/simple/PyBlockWork/ which contains no link. I guess something must be wrong in the setup.py file but I cannot figure what.

4

1 回答 1

1

这个问题的长答案在于PEP 438。简短的回答是通过 PyPi 分发 python 包是重新定义的。默认情况下,新注册的包处于 pip 不再访问“url”和“download_url”的模式。此外,链接不会自动添加到 https://pypi.python.org/simple/[package_name]/ 网页。要恢复到旧的行为,可以登录他/她的 PyPi 帐户并在他/她的包的“url”选项卡中选择“如上所述,但还要求工具抓取主页和下载 URL(慢!)”作为托管模式. 当然,这有很多含义,可以通过阅读有关此主题的内容来理解。阅读PEP 438是一个不错的起点,但对于那些想要了解更多信息的人来说,这里也是一个不错的去处

于 2013-11-03T23:58:28.233 回答