2013-03-06 37 views
-1

我是一個新手編譯器,並且在sconstruct中遇到了一些麻煩。Scons找不到cython

我有一個全新的osx(山獅)安裝(是的,它是其中一個週末)。我已經通過pip安裝了cython。它位於/ usr/local/share/python。這個目錄也在我的PATH中。如果我從提示符運行scons正在禁止的命令,它就完成了。

但是,我正在嘗試構建的源代碼的scons腳本無法找到cython。從下面的記錄中可以看出,我的PATH正在正確傳遞給scons。

任何意見將不勝感激!

~/Desktop/Fiat-Lux> scons 
scons: Reading SConscript files ... 
Checking whether the C++ compiler works(cached) yes 
Checking for C function printf()... (cached) yes 
Checking for C++ library m... (cached) yes 
Checking for C library boost_system-mt... (cached) yes 
    --> Setting HOME : /Users/davidcranor 
    --> Appending custom PATH : /usr/local/share/python:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 
    --> Appending custom PYTHONPATH : /usr/local/lib/python2.7/site-packages: 
Staging directory: /Users/davidcranor/Desktop/Fiat-Lux/build/ 
Checking for C++ library boost_system-mt... (cached) yes 
Checking for C++ library boost_thread-mt... (cached) yes 
Checking for C++ library boost_program_options-mt... (cached) yes 
Checking for C++ library boost_filesystem-mt... (cached) yes 
Checking for C++ library jack... (cached) yes 
Checking for C++ library aubio... (cached) yes 
Checking for C++ header file Eigen/Dense... (cached) yes 
Checking for C++ library opencv_core... (cached) yes 
Checking for C++ library opencv_imgproc... (cached) yes 
Checking for C++ library opencv_highgui... (cached) yes 
Checking for C library openlase... (cached) yes 
scons: done reading SConscript files. 
scons: Building targets ... 
cython --cplus -o xenon/Python/xenon_core.cc xenon/Python/xenon_core.pyx 
sh: cython: command not found 
scons: *** [xenon/Python/xenon_core.cc] Error 127 
scons: building terminated because of errors. 
+0

寫在用Cython終端,並把此輸出 – 2013-03-06 17:04:03

+0

似乎調用編譯器就好了....〜/桌面/ Fiat- Lux> cython Cython(http://cython.org)是用於編寫以 Cython語言編寫的代碼的編譯器。 Cython基於Greg Ewing的Pyrex。 用法:用Cython [選項] {的資源文件PYX,PY} ... 選項: -V,用Cython編譯 – David 2013-03-06 17:46:59

+0

的--version顯示版本號據我所知scons的不具備用Cython的buildin支持。所以調用cython的代碼必須由腳本提供,並且可能會在某處被破壞。 – Arpegius 2013-03-06 18:49:13

回答

1

scons FAQ

爲什麼不使用SCons找到我的編譯器/連接/等?我可以在命令行中執行它。

當然,通過將外部環境變量傳播到構建中,您可能會以無意的方式運行外部環境變化會影響構建的風險。該方法以保證構建是可重複的是明確地初始化PATH

path = ['/bin', '/usr/bin', '/path/to/other/compiler/bin'] 
env = Environment(ENV = {'PATH' : path}) 
+0

在我來到這裏之前(我承諾!),我閱讀了常見問題解答,但我不願意將我的個人路徑編碼到Sconstruct文件中,然後將其檢查回github .... Sconstruct文件的確有一個指令通過上面的logfile將外部環境(和工作環境)傳播到構建中(您可以在第8行看到)。有沒有另一種方法可以使它更清潔?在此期間,將會破解這一點。感謝您看看這個。 – David 2013-03-06 17:51:46

+0

我並不打算聽起來有點意思,但又從常見問題「SCons不使用從命令行使用的相同PATH環境變量,因此無法找到已安裝在」標準「的位置,除非你告訴它如何。」儘管'pip'認爲'/ usr/local/share/python'是非標準的。硬代碼不是那麼難,因爲它是全球性的,你只需要做一次... – danodonovan 2013-03-06 18:01:44

+0

好吧,我試了你的方式,它的工作。只是想知道,雖然......之前,在我的Sconfig文件(我刪除了)中有'env.Append(PATH = os.environ ['PATH'])'和'/ usr/local/share/python'操作系統的路徑。它似乎會傳播正確,你會介意解釋爲什麼不?謝謝你的幫助! – David 2013-03-07 16:37:14