2012-04-14 127 views
1

當通過pip install readline安裝的readline時建立的readline的C擴展,我得到一個錯誤信息如下: -PIP在Mac OS X上安裝的readline(10.7.3)失敗

Beginning configuration for readline-6.2 for i386-apple-darwin11.3.0 



checking whether make sets $(MAKE)... yes 

checking for gcc... gcc 

checking for C compiler default output file name... 

configure: error: in `/Users/calvin/.virtualenvs/myproj/build/readline/rl/readline-lib': 

configure: error: C compiler cannot create executables 

See `config.log' for more details. 





============ Building the readline library ============ 





============ Building the readline extension module ============ 



running install 

running build 

running build_ext 

building 'readline' extension 

Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.7.sdk 

搜索的位置我的系統上的MacOSX10.7.sdk顯示: -

calvin$ sudo find/-name "MacOSX10.7.sdk" 
Password: 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk 
find: /dev/fd/3: Not a directory 
find: /dev/fd/4: Not a directory 

這不是readline編譯期望的地方。

pip如何找到MacOSX10.7.sdk有問題嗎?

如何解決這個問題,而不是將MacOSX10.7複製到/Developer/SDKs目錄中?

澄清

這是怎麼了我暫時解決我的問題。

calvin$ sudo mkdir -p /Developer/SDKs/ 
Password: 

calvin$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk /Developer/SDKs/MacOSX10.7.sdk 

calvin$ pip install readline 

但我不太清楚這是「適當」的方式來解決這個問題,因爲可能有無論是從PIP應該是怎樣找到我的.sdk位置或我很想念我的系統的東西一些固有的問題路徑。因此,有關如何解決這種「適當」方式的建議將非常感謝!

回答

2

這是一個很好的問題。作爲一個注意點,我/Developer/SDKs有一個MacOSX10.7.sdk文件夾,所以也許這是你的文件系統的狀態是錯誤的。

最安全的方法可能是安裝XCode,但這在時間上非常昂貴。我將通過創建一個軟鏈接開始:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk /Developer/SDKs/MacOSX10.7.sdk

,看看如果這樣做的伎倆。

+0

是的。這正是我解決我的問題的方法。 所以,現在我想知道我在安裝Xcode時做了什麼錯誤...不應該出現這種情況,因爲我可以從Xcode編譯我的iPhone應用程序,而不會出現任何問題... – 2012-04-14 02:33:42

+0

Aha。這似乎是因爲我使用的是最新版本的Xcode,它已經移動了它的MacOSX10.7.sdk位置!參考鏈接https://trac.macports.org/ticket/33283建設庫的其他開發人員遇到同樣的問題,並正在尋求港口維護人員更改/更新sdk位置的說明。 – 2012-04-14 02:37:38

+2

它將在Python的下一個發行版中得到修復:http://bugs.python.org/issue14499 – 2012-04-14 04:12:52