2

我写了一个小工具并上传到 pypi (这里),但我无法使用 pip 下载它。这是点子日志:

------------------------------------------------------------
c:\python32\scripts\pip-script.py run on 04/11/12 15:53:45
Downloading/unpacking undo

  Getting page http://pypi.python.org/simple/undo
  Could not fetch URL http://pypi.python.org/simple/undo: HTTP Error 301: Moved Permanently - Redirection to url '/simple/undo/' is not allowed
  Will skip URL http://pypi.python.org/simple/undo when looking for download links for undo
  Getting page http://pypi.python.org/simple/
  Real name of requirement undo is undo

  URLs to search for versions for undo:
  * http://pypi.python.org/simple/undo/
  Getting page http://pypi.python.org/simple/undo/
  Getting page http://bitbucket.org/aquavitae/undo
  Analyzing links from page http://pypi.python.org/simple/undo/
    Skipping link http://bitbucket.org/aquavitae/undo (from http://pypi.python.org/simple/undo/); not a file
    Could not parse version from link: https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/)
    Skipping link https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/); wrong project name (not undo)
  Could not find any downloads that satisfy the requirement undo

No distributions at all found for undo

Exception information:
Traceback (most recent call last):
  File "C:\python32\lib\site-packages\pip\basecommand.py", line 104, in main
    status = self.run(options, args)
  File "C:\python32\lib\site-packages\pip\commands\install.py", line 245, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\python32\lib\site-packages\pip\req.py", line 978, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:\python32\lib\site-packages\pip\index.py", line 157, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for undo

谁能看到我哪里出错了?我在代理后面,虽然这可能是问题,但 pip 与其他软件包没有问题,只是这个,所以我假设我以某种方式将它打包错了。

4

5 回答 5

1

https 中的 bitbucket 链接仅在您通过身份验证时才有效。请改用 bitbucket 上的 http 链接。

(pypi页面中的两个网站/问题跟踪链接的相同问题,我无法在没有先登录的情况下访问它)

编辑:http链接重定向到登录页面,登录后,我得到:

您无权访问此存储库。

于 2012-04-11T14:37:04.700 回答
1

有多个问题:您的 tar 文件中没有包名('undo' 不是 'latest.tar.gz' 的子字符串);并且 pypi 出于某种原因想要重定向(这似乎不正常,所以我不会进入那个)。

通常 pip 首先查看与您的包名称匹配的所有 url,包括主页和 pypi 在http://pypi.python.org/simple/undo/上提供的下载页面(假设您同时指定了两者)。分析那些页面上包含项目名称的任何 url。

有几件事使 pip 拒绝一个 url:

Skipping link http://bitbucket.org/aquavitae/undo (from http://pypi.python.org/simple/undo/); not a file

这个 url 里面有 undo,但它没有指向一个文件。

Could not parse version from link: https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/)

没有版本号latest.tar.gz

Skipping link https://bitbucket.org/aquavitae/undo/get/latest.tar.gz (from http://pypi.python.org/simple/undo/); wrong project name (not undo)

文件组件中没有项目名称undo

现在的工作是因为https://bitbucket.org/aquavitae/undo/downloads可以访问并且在其中的文件名部分有 3 个带有撤消的链接,还有很多很多没有的链接。采用:

pip install undo --no-install --log undo.log

并查看undo.log文件。

Please note that pip uses the function parse_versions from the pkg_resources (in dist_packages) to determine what is the newest version available. So even if you specify undo-1.1.tar.gz explicitly as the the version on your pypi download link, if your homepage also points to newer version like undo-1.2-dev-20120614 the latter is taken as found.

于 2012-06-14T09:53:41.990 回答
0

您可能需要使用以 latest.tar.gz#egg=undo 之类结尾的链接

于 2012-04-12T04:24:06.067 回答
0

我不知道它是 pip 中的错误还是故意的,但是一旦我打开 bitbucket 站点它就可以工作,尽管它需要下载(并确实下载)的实际文件托管在 pypi 上。所以如果其他人有这个问题,解决方案是确保 pypi 页面上的所有链接都可以访问,即使它们没有托管下载文件。

于 2012-04-12T05:21:04.670 回答
0

setup.py将'更改download_urlhttps://bitbucket.org/aquavitae/undo/get/undo-0.5.1.tar.gz

于 2012-04-13T13:28:12.517 回答