“错误:选项-无法识别单一版本-外部版本管理”表示什么?

问题:“错误:选项-无法识别单一版本-外部版本管理”表示什么?

error: option --single-version-externally-managed not recognized在加入pip installvarions软件包(包括PyObjCastropy)时似乎突然开始遇到错误。我以前从未见过此错误,但现在它也出现在travis-ci构建中,但没有任何更改。

此错误是否表示已过期?还是某些错误指定的选项setup.py?还是完全其他?

I seem to have suddenly started encounter the error error: option --single-version-externally-managed not recognized when pip installing varions packages (including PyObjC and astropy). I’ve never seen this error before, but it’s now also showing up on travis-ci builds for which nothing has changed.

Does this error indicate an out of date distribute? Or some incorrectly specified option in setup.py? Or something else entirely?


回答 0

新更新:

安装最新版本的setuptools。如果仍然出现错误,请wheel同时安装。

pip install -U setuptools
pip install -U wheel

原始答案/更多详细信息:

--single-version-externally-managed 是用于Python软件包的选项,指示setuptools模块创建一个Python软件包,如果需要,可以由主机的软件包管理器轻松地管理它,例如Yum或Apt。

如果您看到此消息,则可能是旧版本的setuptools或Python。尝试使用Distribute,它是setuptools的较新版本,并且向后兼容。这些软件包可能希望您已经拥有它。

https://pypi.python.org/pypi/distribute

编辑:至此,分发已经合并到主setuptools项目中。只需安装最新版本的setuptools。正如@wynemo指出的那样,您可能希望使用该--egg选项,因为它更适合那些不希望创建要分发的系统软件包的手动安装人员。

New Update:

Install the latest version of setuptools. If you still get the error, install wheel as well.

pip install -U setuptools
pip install -U wheel

Original Answer / More Details:

--single-version-externally-managed is an option used for Python packages instructing the setuptools module to create a Python package which can be easily managed by the host’s package manager if needed, like Yum or Apt.

If you’re seeing this message, you may have an old version of setuptools or Python. Try using Distribute, which is a newer version of setuptools and is backwards compatible. These packages may expect that you have it already.

https://pypi.python.org/pypi/distribute

Edit: At this point, distribute has been merged into the main setuptools project. Just install the latest version of setuptools. As @wynemo indicated, you may wish to use the --egg option instead, as it’s more appropriate for those doing manual installations where you’re not intending to create a system package for distribution.


回答 1

添加--egg选项

pip install --egg SCons

我使用pip1.4.1版

Add --egg option

pip install --egg SCons

I use pip version 1.4.1


回答 2

安装wheel最近解决了这个问题pip(我使用的是8.1.2):

pip install wheel

Installing wheel resolved this issue with recent pip (I used 8.1.2):

pip install wheel

回答 3

尝试像这样升级setuptools:

pip install --upgrade setuptools

Try upgrading setuptools like this:

pip install --upgrade setuptools


回答 4

我有这个问题。原来,我的pip缓存中的文件权限存在问题。

如果您在pip输出的开头看到一条消息,例如

The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

您可能有同样的问题。您可以通过确保对pip缓存具有适当的文件权限(例如chown -R $(whoami) /home/ubuntu/.cache/pip)来解决它,或者,如果您使用的是UNIX,则可以使用XDG_CACHE_HOMEenv var 将pip缓存位置设置为您拥有的某个文件夹。

I was having this problem. It turned out it was a problem with the file permissions on my pip cache.

If you see a message at the very beginning of your pip output like

The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

you might have the same problem. You can resolve it by either ensuring that you have proper file permissions on your pip cache (something like chown -R $(whoami) /home/ubuntu/.cache/pip) or, if you’re on a UNIX, you can set the pip cache location with the XDG_CACHE_HOME env var to some folder you do own.


回答 5

我尝试了上述解决方案。但是,只有执行以下操作,我才能解决该问题:

sudo pip3 install -U pip (对于python3)

I tried the above solutions. However, I only can resolve the problem until I do:

sudo pip3 install -U pip (for python3)


回答 6

当我尝试升级一个python软件包时,我的macbook上也出现此问题。我在OS X中检查了pip版本,它太旧了:1.1。我使用Follow cmd将pip升级到1.5.6

easy_install -U pip

然后,此错误将得到解决。

I have this problem on my macbook also when I try to upgrade one python package. I check pip version in OS X, it’s too old: 1.1. I use follow cmd to upgrade pip to 1.5.6

easy_install -U pip

Then this error is fixed.