2015-09-29 273 views
6

我想在我的Mac上安裝xgboost爲Python 3.4,但我發現後,「PIP 3的setup.py安裝」以下錯誤:蟒蛇xgboost安裝

File "<string>", line 20, in <module> 

    File "/private/var/folders/_x/rkkz7tjj42g9n8lqq5r0ry000000gn/T/pip-build-2dc6bwf7/xgboost/setup.py", line 28, in <module> 

    execfile(libpath_py, libpath, libpath) 

NameError: name 'execfile' is not defined 

當與運行它 - v選項來獲取詳細輸出錯誤看起來像這樣:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_x/rkkz7tjj42g9n8lqq5r0ry000000gn/T/pip-build-2dc6bwf7/xgboost 
Exception information: 
Traceback (most recent call last): 
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/basecommand.py", line 232, in main 
    status = self.run(options, args) 
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/commands/install.py", line 339, in run 
    requirement_set.prepare_files(finder) 
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/req/req_set.py", line 385, in prepare_files 
    req_to_install.run_egg_info() 
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/req/req_install.py", line 358, in run_egg_info 
    command_desc='python setup.py egg_info') 
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/utils/__init__.py", line 749, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_x/rkkz7tjj42g9n8lqq5r0ry000000gn/T/pip-build-2dc6bwf7/xgboost 

我該如何解決這個問題?

回答

2

我認爲xgboost只是作爲Python 2包通過pip提供。 有兩種可能性讓它工作。

  1. 您使用Python 2並使用pip進行安裝。
  2. 您可以手動爲Python 3構建xgboost。只需從github下載源代碼並構建它:打開終端。從git:git clone https://github.com/dmlc/xgboost.git退房。構建它:cd xgboost;使; cd包裝; python.py安裝安裝--user
+3

1.我在2.7 – Anton

+0

2.工作對我來說與CD xgboost得到同樣的錯誤;運行./build.sh; python setup.py install --user – Anton

5

這對我有用。

OS:OSX埃爾卡皮坦

第1步:cd xgboost; ./build.sh
步驟2:cd python-package; python setup.py install

+1

適用於OS X Yosemite也 –

0

也許你應該使用

cd xgboost; cp make/minimum.mk ./config.mk; make -j4 

,而不是

cd xgboost; ./build.sh 

爲每一個「建立在OSX」建設文件第

也或許這是一個duplicate