通过 pip 安装本地 wheel 时出现 ValueError "Expected version spec"

ValueError "Expected version spec" when installing local wheel via pip

我有一个正在开发的闭源 Python 模块,想与我工作场所的人分享。我已经通过 setup.py bdist_wheel 使用此 setup.py 文件构建了一个轮子:

#!/usr/bin/env python

from setuptools import setup, find_packages

setup(name='mypkg',
      version='0.0.1',
      description='tools for work',
      author='tbhartman',
      packages=find_packages('src', exclude=['test*']),
      package_dir = {'':'src'},
      entry_points={
          'console_scripts':[
              'runtool = mypkg.run:main',
              ],
          },
      install_requires = ['argparse'],
      classifiers = [
          'Development Status :: 3 - Alpha',
          'Programming Language :: Python :: 2',
          ]
     )

我想测试安装过程,所以我试试 pip 安装 dist\mypkg-0.0.1-py2-none-any.whl 并获得以下回溯:

Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip\basecommand.py", line 139, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip\commands\install.py", line 235, in run
    InstallRequirement.from_line(name, None))
  File "C:\Python27\lib\site-packages\pip\req.py", line 118, in from_line
    return cls(req, comes_from, url=url)
  File "C:\Python27\lib\site-packages\pip\req.py", line 43, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2929, in parse
    reqs = list(parse_requirements(s))
  File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2876, in parse_requirements
    "version spec")
  File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2841, in scan_list
    raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', 'dist/mypkg-0.0.1-py2-none-any.whl', 'at', '/mypkg-0.0.1-py2-none-any.whl')

Storing complete log in C:\Users\tbhartman\pip\pip.log

问题是什么以及如何解决?

我使用的是非常过时的 PIP 版本。

$ pip -V
pip 1.3.1 from C:\Python27\lib\site-packages (python 2.7)

我升级到pip 6.0.8,一切正常。

在 AWS 上使用 Ubuntu 14.04 AMI,我发现我必须升级 setuptools:

sudo pip3 install -vU setuptools