2011-09-22 84 views
2

我試圖運行Hadoopy,但我在OS X上得到一個編譯錯誤:Cython&Hadoopy編譯錯誤..有關修復的任何想法?

ImportError: Building module failed: ["CompileError: command 'llvm-gcc-4.2' failed with exit status 1\n" 

我在$PATH/Developer/usr/bin,並正在運行的OS X Lion的10.7最新版本的Xcode。 Cython通過easy_install安裝。

全輸出:

>>> import pyximport; pyximport.install() 
>>> import hadoopy 
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c:236:22: error: getdelim.h: No such file or directory 
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c:236:22: error: getdelim.h: No such file or directory 
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c: In function ‘__pyx_f_7hadoopy_5_main_11HadoopyTask_read_offset_value_text’: 
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c:4399: warning: implicit conversion shortens 64-bit value into a 32-bit value 
lipo: can't open input file: /var/folders/8b/n0j5pn_13qn_x8p2v4f848zh0000gn/T//ccC8x2Ex.out (No such file or directory) 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Python/2.7/site-packages/hadoopy/__init__.py", line 22, in <module> 
    from _main import run, print_doc_quit 
    File "/Library/Python/2.7/site-packages/Cython-0.15.1-py2.7-macosx-10.7-intel.egg/pyximport/pyximport.py", line 335, in load_module 
    self.pyxbuild_dir) 
    File "/Library/Python/2.7/site-packages/Cython-0.15.1-py2.7-macosx-10.7-intel.egg/pyximport/pyximport.py", line 183, in load_module 
    so_path = build_module(name, pyxfilename, pyxbuild_dir) 
    File "/Library/Python/2.7/site-packages/Cython-0.15.1-py2.7-macosx-10.7-intel.egg/pyximport/pyximport.py", line 167, in build_module 
    reload_support=pyxargs.reload_support) 
    File "/Library/Python/2.7/site-packages/Cython-0.15.1-py2.7-macosx-10.7-intel.egg/pyximport/pyxbuild.py", line 85, in pyx_to_dll 
    dist.run_commands() 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands 
    self.run_command(cmd) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command 
    cmd_obj.run() 
    File "/Library/Python/2.7/site-packages/Cython-0.15.1-py2.7-macosx-10.7-intel.egg/Cython/Distutils/build_ext.py", line 135, in run 
    _build_ext.build_ext.run(self) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 340, in run 
    self.build_extensions() 
    File "/Library/Python/2.7/site-packages/Cython-0.15.1-py2.7-macosx-10.7-intel.egg/Cython/Distutils/build_ext.py", line 143, in build_extensions 
    self.build_extension(ext) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 499, in build_extension 
    depends=ext.depends) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/ccompiler.py", line 624, in compile 
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/unixccompiler.py", line 180, in _compile 
    raise CompileError, msg 
ImportError: Building module failed: ["CompileError: command 'llvm-gcc-4.2' failed with exit status 1\n" 
+0

@eryksun - 你是一個天才。起初,我認爲我應該用Cython做到這一點,但後來才意識到我要用Hadoopy來做到這一點。請發佈這個答案,所以我可以接受:) –

回答

4

而不是使用pyximport的,與python setup.py build_ext --inplace建立擴展模塊到位(或python setup.py develop安裝就地開發,或只是一個普通的通過python setup.py install安裝)。對於軟件包,您幾乎總是希望運行安裝程序,這將正確配置編譯環境,編譯和安裝過程。如果你使用用Cython加快你的代碼(例如,用於科學計算)


pyximport好您的個人腳本。即使那樣,您可能需要引入其他庫,並從多個來源構建。在這種情況下,您可以使用pyxbld文件來設置sources和include_dirs。例如,假設您有foo.pyx,那麼您可以將構建指令放置在同一目錄中的foo.pyxbld中。例如:

#foo.pyxbld 
def make_ext(modname, pyxfilename): 
    from distutils.extension import Extension 
    return Extension(name = modname, 
        sources=[pyxfilename, 'bar.c'], 
        include_dirs=['/myinclude']) 
def make_setup_args(): 
    return dict(script_args=["--compiler=mingw32"]) 

現在使用foo是作爲下面簡單:

import pyximport 
pyximport.install() 
import foo 

。假定有沒有編譯錯誤,它幾乎透明的,但延遲的第一次導入模塊。後續導入將在家庭/個人資料目錄的.pyxbld子目錄中查找構建的擴展。

6

對我來說這是一個安裝問題,使用下述步驟,我已經固定它的某個時候回來:

+0

這對我幫助很大!仍然在2015年7月,'pip安裝hadoopy'失敗,但這工作。 – Tommy

+0

同意。點安裝沒有工作,許多互聯網'修復'沒有工作。但是這樣做。非常感謝! – SummerEla

相關問題