2011-08-03 64 views
1

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

> 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 
+0

您正在使用哪个版本的easy_install?请给出'easy_install easy_install-2.6'的结果。 –

回答

2

很难确定您所包含的缩写回溯。一种可能性是,您在Mac OS X 10.5上安装的独立Python 2.5,很可能使用python.org安装程序,但未被复制。如果是这样,您需要在那里安装一个类似的Python 2.5或从旧安装中移动/Library/Frameworks/Python.frameworks。或者您应该更新为使用更新的Python,无论是python.org的系统还是Mac OS X的第三方开源代理商之一,如MacPorts或自制软件或Fink或ActiveState。

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

更新:所以看起来你已经安装了一个easy_install作为额外的python.org,或者至少为/Library/Frameworks/Python.framework/Versions/Current指向的任何版本的Python。你似乎必须在这里有两个单独的问题(使用Python 2.5,而使用Python 2.6的另一个)。在这一点上,我很难猜出任何一个问题都没有得到更多的信息。这可能是最好的清理和重新开始。

  1. 如果你想删除旧的Python 2.5从旧系统结转,可以按照有关如何删除已安装的Python一python.org说明here。如果你愿意,你可以先做出一个副本或者类似的东西,而不是将其重命名:

    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. 检查,如有必要,在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/[email protected] -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 
    lrwxr-xr-x 1 root wheel  82 Nov 7 2010 /usr/bin/[email protected] -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config 
    lrwxr-xr-x 1 root wheel  75 Nov 7 2010 /usr/bin/[email protected] -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 
    lrwxr-xr-x 1 root wheel  82 Nov 7 2010 /usr/bin/[email protected] -> ../../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/[email protected] -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5 
    lrwxr-xr-x 1 root wheel  76 Nov 7 2010 /usr/bin/[email protected] -> ../../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或自制,MacPorts的安装最新的蟒蛇(Python的2.7.2是Python 2中的当前版本), Fink,ActiveState等。根据需要更新您的shell PATH。 (例如,默认情况下,python.org安装程序会适当地修改您的shell配置文件。)

  8. 如果安装程序尚未附带easy_install(python.org不包含,其他一些软件包有一个可选包这样做),安装Distribute包,它将提供一个easy_install

+0

这并没有解决任何已安装的Python的问题,但我做了以下事情:1)重新安装xcode; 2)删除所有安装的Pythons; 3)安装2.7。现在起作用了。谢谢。 – Massimo

1

您是否安装了XCode?看起来你没有。