Python “错误:无法识别选项 --single-version-externally-managed” 表示什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14296531/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 11:00:32  来源:igfitidea点击:

What does "error: option --single-version-externally-managed not recognized" indicate?

pythonpipdistribute

提问by keflavich

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

我似乎突然开始error: option --single-version-externally-managed not recognizedpip installing varions 包(包括PyObjCastropy)时遇到错误。我以前从未见过这个错误,但它现在也出现在 travis-ci 构建中,但没有发生任何变化。

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

此错误是否表示分发已过期?或者一些错误指定的选项setup.py?或者完全是别的什么?

采纳答案by Kelketek

New Update:

新更新:

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

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

pip install -U setuptools
pip install -U wheel


Original Answer / More Details:

原始答案/更多细节:

--single-version-externally-managedis 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.

--single-version-externally-managed是一个用于 Python 包的选项,指示 setuptools 模块创建一个 Python 包,如果需要,它可以由主机的包管理器轻松管理,如 Yum 或 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.

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

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

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

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

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

回答by wynemo

Add --eggoption

添加--egg选项

pip install --egg SCons

I use pipversion 1.4.1

我使用pip版本 1.4.1

回答by NewPtone

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

当我尝试升级一个 python 包时,我的 macbook 也有这个问题。我在 OS X 中检查了 pip 版本,它太旧了:1.1。我使用follow cmd将pip升级到1.5.6

easy_install -U pip

Then this error is fixed.

然后这个错误是固定的。

回答by sparrowt

Try upgrading setuptools like this:

尝试像这样升级 setuptools:

pip install --upgrade setuptools

pip install --upgrade setuptools

回答by Seth Difley

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

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

pip install wheel

回答by sans

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

我遇到了这个问题。原来这是我的 pip 缓存上的文件权限问题。

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

如果您在 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.

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_HOMEenv var to some folder you do own.

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