未找到安装工具

发布于 2024-09-17 21:50:53 字数 226 浏览 3 评论 0原文

我从 Linux 切换到 OSX,当我运行构建的 setup.py 脚本时,我收到一条错误消息,其中包含以下文本

此脚本需要 setuptools 版本 0.6c7。

我已经尝试了几次安装setuptools,并验证了setuptools Egg存在于/Library/Python/2.6/site-packages中。我不知道为什么它不被认可。

I am switching from Linux to OSX and when I run our build's setup.py script, I get an error message that contains the text

This script requires setuptools version 0.6c7.

I have tried several times to install setuptools, and have verified that the setuptools egg exists in /Library/Python/2.6/site-packages. I have no idea why it is not being recognized.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

痴情换悲伤 2024-09-24 21:50:53

OS X 系统上有多个版本的 Python 是很常见的。在最近发布的 OS X 中,Apple 本身发布了两个版本(在 /usr/bin 中)。您可能已经使用 python.org 中的安装程序(通常存在于 /Library/Frameworks/Python.framework 中)或使用 MacPorts 等软件包分发程序(安装在 /opt/ 中)安装了更新版本local/Library/Frameworks/Python.framework)。请记住,每个版本的 Python 都需要自己的 setuptools 副本,

因为您报告的站点包路径是 /Library。 /Python/2.6/site-packages,您很可能在 OS X 10.6 中使用了 Apple 提供的 Python 2.6.1 来尝试安装新版本的 setuptools。 Apple 已经为其 Python 提供了 setuptools(10.6 中的 2.6.1 为 0.6c9),相应的 easy_install 命令位于 /usr/bin 中;如果

$ /usr/bin/python2.6 -c 'import setuptools;print(setuptools.__file__,setuptools.__version__)'
('/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/__init__.pyc', '0.6c9')

您使用的是其他非 Apple 提供的 Python,请按照说明安装新版本的 setuptools(或 Distribute),确保您调用正确版本的 . Python。检查您的 shell PATH 和 which python 以确保。

如果这没有帮助,请使用更多信息更新您的问题。

更新:根据您的进一步评论,您的默认站点包目录中似乎有问题。解决了这个问题并确定安装了 Apple 提供的 setuptools 版本 0.6c9,您尝试安装的软件包似乎正在寻找特定的早期版本的 setuptools, 0.6c7。如果是这种情况,您应该首先确定原因以及是否有必要。很可能这只是包的 setup.py 文件中的版本规范不正确,即使用 == 而不是 >=。如果可以的话,编辑 setup.py 以便它可以使用更新的版本。万一该包确实确实需要特定旧版本的setuptools(甚至可能无法与该版本的 Python 或 OS X 配合使用),您可以尝试安装旧版本,如下所示:

$ sudo /usr/bin/easy_install-2.6 setuptools==0.6c7
$ /usr/bin/python2.6 -c 'import setuptools;print(setuptools.__file__,setuptools.__version__)'
('/Library/Python/2.6/site-packages/setuptools-0.6c7-py2.6.egg/setuptools/__init__.pyc', '0.6c7')

但是如果可能的话,您确实应该避免这样做,因为这将在 /usr/local/ 中安装另一个旧版本的 easy_install bin 并可能导致安装和使用其他软件包时出现问题。

It is very common to have multiple versions of Python on OS X systems. In recent releases of OS X, Apple has shipped two versions itself (in /usr/bin). You may have installed more recent versions using installers from python.org (which generally exist in /Library/Frameworks/Python.framework or using a package distributor like MacPorts (which install in /opt/local/Library/Frameworks/Python.framework). Keep in mind that each version of Python requires its own copy of setuptools.

Since the site package path you report is /Library/Python/2.6/site-packages, it is most likely you have used the Apple-supplied Python 2.6.1 in OS X 10.6 to try to install a new version of setuptools. Note that Apple already supplies setuptools for its Pythons (0.6c9 for 2.6.1 in 10.6); the corresponding easy_install commands are in /usr/bin.

$ /usr/bin/python2.6 -c 'import setuptools;print(setuptools.__file__,setuptools.__version__)'
('/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/__init__.pyc', '0.6c9')

If you are using another non-Apple-supplied Python, follow the instructions to install a new version of setuptools (or Distribute) making sure you are invoking the right version of Python. Check your shell PATH and which python to make sure.

If that doesn't help, update your question with more information.

UPDATE: Based on your further comments, it seems something was amiss in your default site-packages directory. With that problem out of the way and having established that there is an Apple-supplied setuptools version 0.6c9 installed, it appears the package you are trying to install is looking for a specific, earlier version of setuptools, 0.6c7. If that is the case, you should first determine why that is and if it is necessary. Chances are that it is just an incorrect version specification in the package's setup.py file, i.e. using == rather than >=. If you can, edit the setup.py so it can use a newer version. In the unlikely event that the package really does need that specific older version of setuptools (which may not even work with that version of Python or OS X), you could try installing the older version, like so:

$ sudo /usr/bin/easy_install-2.6 setuptools==0.6c7
$ /usr/bin/python2.6 -c 'import setuptools;print(setuptools.__file__,setuptools.__version__)'
('/Library/Python/2.6/site-packages/setuptools-0.6c7-py2.6.egg/setuptools/__init__.pyc', '0.6c7')

But you really should avoid doing that if at all possible as that will install another older version of easy_install in /usr/local/bin and could cause problems with installing and using other packages.

缺⑴份安定 2024-09-24 21:50:53

您是否尝试过在 setup.py 脚本中导入 setuptools ?

import setuptools

这解决了我过去的 setuptool-ish 构建问题。

Have you tried to import setuptools in your setup.pyscript?

import setuptools

This solved my setuptool-ish build problems in the past.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文