【问题标题】:easy_install broken on MacMac 上的 easy_install 坏了
【发布时间】:2011-08-03 22:38:21
【问题描述】:

我已将我的主文件夹从 Mac OSX 10.5 复制到新的 Mac OSX 10.6。这打破了二进制包的east_intall。例如,如果我使用 Python 2.5:

> easy_install celery
Searching for celery
Reading http://pypi.python.org/simple/celery/
Reading http://github.com/ask/celery/
Reading http://celeryproject.org
Best match: celery 2.2.7
Downloading http://pypi.python.org/packages/source/c/celery/celery-2.2.7.tar.gz#md5=5826cf891eaa6175cc7aab67818094fe
Processing celery-2.2.7.tar.gz
Running celery-2.2.7/setup.py -q bdist_egg --dist-dir /var/folders/TK/TKwwrl0JEyKrCVteN9D+Jk+++TI/-Tmp-/easy_install-RSjVZt/celery-2.2.7/egg-dist-tmp-w4bMT_
...
In file included from Modules/_multiprocessing/multiprocessing.h:6,
                 from Modules/_multiprocessing/multiprocessing.c:9:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:18:20: error: limits.h: No such file or directory
...
... millions of errors
...

error: Setup script exited with error: command 'gcc' failed with exit status 1

如果我使用 Python 2.6

> easy_install-2.6 celery
Searching for celery
Reading http://pypi.python.org/simple/celery/
Reading http://github.com/ask/celery/
Reading http://celeryproject.org
Best match: celery 2.2.7
Downloading http://pypi.python.org/packages/source/c/celery/celery-2.2.7.tar.gz#md5=5826cf891eaa6175cc7aab67818094fe
Processing celery-2.2.7.tar.gz
Running celery-2.2.7/setup.py -q bdist_egg --dist-dir /var/folders/TK/TKwwrl0JEyKrCVteN9D+Jk+++TI/-Tmp-/easy_install-dCVly4/celery-2.2.7/egg-dist-tmp-PqOUyI
error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: /var/folders/TK/TKwwrl0JEyKrCVteN9D+Jk+++TI/-Tmp-/easy_install-dCVly4/celery-2.2.7/temp/easy_install-61UKvH/PasteDeploy-1.5.0/temp/easy_install-ExR4d0/Paste-1.7.5.1/temp/easy_install-OJw80Y/PasteDeploy-1.5.0/temp/easy_install-Zg0wGJ/Paste-1.7.5.1/temp/easy_install-aWn8hm/PasteDeploy-1.5.0/temp/easy_install-1TOXq2/Paste-1.7.5.1/temp/easy_install-r97tJG/PasteDeploy-1.5.0/temp/easy_install-CNdClq/Paste-1.7.5.1/temp/easy_install-XUejp4/PasteDeploy-1.5.0/temp/easy_install-xN6Jd6/Paste-1.7.5.1/temp/easy_install-zFbJOI/PasteDeploy-1.5.0/temp/easy_install-fc2q_2/Paste-1.7.5.1/temp/easy_install-1rTVrG/PasteDeploy-1.5.0/temp/easy_install-rii66v/Paste-1.7.5.1/temp/easy_install-cZBf5J/PasteDeploy-1.5.0/temp/easy_install-ICPv8M/Paste-1.7.5.1/temp/easy_install-RwRQIz/PasteDeploy-1.5.0/temp/easy_install-x74lHT/Paste-1.7.5.1/temp/easy_install-Yf8l74/PasteDeploy-1.5.0/temp/easy_install-fnl5Wt/Paste-1.7.5.1/temp/easy_install-OwWNt9/PasteDeploy-1.5.0/temp/easy_install-WkOs3d/Paste-1.7.5.1/docs/include/reference_header.txt: File name too long

这不是一个特定于芹菜的问题。我在 lxml、matplotlib、scipy 等方面遇到了类似的错误。所有二进制包都会出现问题,而不是纯 python 包。我做错了什么?

> which easy_install
/Library/Frameworks/Python.framework/Versions/Current/bin/easy_install
> which easy_install-2.6
/usr/bin/easy_install-2.6

【问题讨论】:

  • 您使用的是哪个版本的easy_install?请给出which easy_install easy_install-2.6的结果。

标签: python easy-install osx-snow-leopard


【解决方案1】:

使用您包含的简短回溯很难确定。一种可能性是您在 Mac OS X 10.5 上安装的单独的 Python 2.5(很可能使用 python.org 安装程序)没有被复制过来。如果是这样,您要么需要在那里安装类似的 Python 2.5,要么从旧安装中移动 /Library/Frameworks/Python.frameworks。或者您应该更新为使用更新的 Python,无论是来自 python.org 的系统之一或一个,还是 Mac OS X 的第三方开源分销商之一,如 MacPorts 或 homebrew 或 Fink 或 ActiveState。

另一种可能性是您需要从 Mac OS X 10.6 的 Xcode 3 安装程序中安装可选的MacOSX 10.4u SDK。如果是这种情况,您应该会看到包含 10.310.4 的错误消息。

更新:看来您确实为额外的 python.org 或至少为/Library/Frameworks/Python.framework/Versions/Current 指向的任何 Python 版本安装了 easy_install。您似乎必须在这里遇到两个单独的问题(Python 2.5 和系统 Python 2.6 的另一个问题)。在这一点上,我很难在没有获得更多信息的情况下猜测其中一个问题是什么。最好清理并重新开始。

  1. 如果您想从旧系统中删除旧的 Python 2.5,您可以按照说明 here 关于如何删除 python.org 安装的 Python。如果你愿意,你可以先复制一份,或者用类似这样的方式重命名它:

    cd /Library/Frameworks/Python.framework/Versions
    sudo mv 2.5 2.5-OLD 
    

    考虑对那里的任何其他 Python 版本执行相同的操作。不要删除或修改/System/Library/Frameworks/usr/bin 中的任何文件。这些目录是 OS X 的一部分。

  2. 确保清理您的 shell 配置文件 .bash_profile 等,以确保您的 PATH 不再包含此 Python。让你没有定义任何意想不到的PYTHONPATH环境变量。

  3. 确保您的主目录中没有任何过时的 Distutils 配置文件。查找并重命名或删除 .pydistutils.cfg 之类的内容。

    cd ~
    ls -al
    

    还要确保您没有在本地目录中安装任何意外的私有包。

    ls -al ~/Library/Python
    ls -al ~/.local
    
  4. 检查并在必要时删除 Apple 提供的 Python 的 site-packages 目录中的任何内容:

    cd /Library/Python/2.6/site-packages
    ls -al
    cd /Library/Python/2.5/site-packages
    ls -al
    
  5. 启动一个新的终端会话并验证一切正常。

  6. 确定要在 10.6 中使用的 Python 版本。如果您可以使用 Apple 提供的 2.6.1 或 2.5.4 版本,请使用它们。他们在/usr/bin 中都有自己的easy_install 版本。

    $ ls -l /usr/bin/python*
    -rwxr-xr-x  2 root  wheel  86000 Jun 24  2010 /usr/bin/python*
    -rwxr-xr-x  5 root  wheel    925 Jul  7  2009 /usr/bin/python-config*
    lrwxr-xr-x  1 root  wheel     75 Nov  7  2010 /usr/bin/python2.5@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
    lrwxr-xr-x  1 root  wheel     82 Nov  7  2010 /usr/bin/python2.5-config@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
    lrwxr-xr-x  1 root  wheel     75 Nov  7  2010 /usr/bin/python2.6@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
    lrwxr-xr-x  1 root  wheel     82 Nov  7  2010 /usr/bin/python2.6-config@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
    -rwxr-xr-x  2 root  wheel  86000 Jun 24  2010 /usr/bin/pythonw*
    lrwxr-xr-x  1 root  wheel     76 Nov  7  2010 /usr/bin/pythonw2.5@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5
    lrwxr-xr-x  1 root  wheel     76 Nov  7  2010 /usr/bin/pythonw2.6@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
    $ ls -l /usr/bin/easy*
    -rwxr-xr-x  2 root  wheel  925 Jun 30  2009 /usr/bin/easy_install*
    -rwxr-xr-x  1 root  wheel  421 Jun 30  2009 /usr/bin/easy_install-2.5*
    -rwxr-xr-x  1 root  wheel  421 Jun 30  2009 /usr/bin/easy_install-2.6*
    
  7. 如果您想要更新和最新版本的 Python,请考虑从 python.org 或 homebrew、MacPorts、Fink、 ActiveState 等。根据需要更新您的 shell PATH。 (例如,默认情况下,python.org 安装程序会适当地修改您的 shell 配置文件。)

  8. 1234563 easy_install 给它。

【讨论】:

  • 这并没有解决任何已安装 Python 的问题,但我做了以下操作:1)重新安装了 xcode; 2) 移除所有已安装的 Python; 3)安装2.7。现在可以了。谢谢。
【解决方案2】:

你安装了 XCode 吗?好像没有。

【讨论】:

    猜你喜欢
    • 2023-03-03
    • 2013-12-13
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    • 2018-09-24
    • 2011-08-13
    • 2012-04-23
    相关资源
    最近更新 更多