2011-08-03 63 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?看起來你沒有。