包在/ usr / local / lib中工作,但不在/ usr / lib中

时间:2016-05-20 15:03:30

标签: python packages

当我安装一个包' python-brick-cinderclient-ext'从它的工作来源。但是当我尝试从我构建的.deb软件包安装它时,我得到了:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/brick_cinderclient_ext/__init__.py", line 30, in <module>
'brick-python-cinderclient-ext').version_string()
File "/usr/lib/python2.7/dist-packages/pbr/version.py", line 457, in version_string
return self.semantic_version().brief_string()
File "/usr/lib/python2.7/dist-packages/pbr/version.py", line 452, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File "/usr/lib/python2.7/dist-packages/pbr/version.py", line 439, in _get_version_from_pkg_resources
result_string = packaging.get_version(self.package)
File "/usr/lib/python2.7/dist-packages/pbr/packaging.py", line 668, in get_version
raise Exception("Versioning for this project requires either an sdist"
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?

但是当我将代码移动到与python setup.py install 安装的相同位置时(来自 /usr/lib/python2.7/dist-packages / /usr/local/lib/python2.7/dist-packages / 然后它工作正常!为什么会这样?

1 个答案:

答案 0 :(得分:0)

pbr.version 模块的名称错误。在__init__.py文件中有 brick-python-cinderclient-ext 而不是 python-brick-cinderclient-ext 。所以,这就是pbr无法获得此软件包版本的原因 - &gt; 它在egg.info 中找不到此类软件包的版本。我已经使用__init__.py文件的补丁修复了它,并将 brick-python-cinderclient-ext 重命名为 python-brick-cinderclient-ext