8

ubuntu 12.04にcythonをインストールしたかったので、ターミナルに入力しました

sudo easy_install cython

応答として、次のエラーが表示されます。

Searching for cython  
Reading http://pypi.python.org/simple/cython/  
Reading http://www.cython.org  
Reading http://cython.org  
Best match: Cython 0.16  
Downloading http://www.cython.org/release/Cython-0.16.zip  
Processing Cython-0.16.zip  
Running Cython-0.16/setup.py -q bdist_egg --dist-dir /tmp/easy_install-VzJ0lH/Cython-0.16/egg-dist-tmp-BMJs3p  
Compiling module Cython.Plex.Scanners ...  
Compiling module Cython.Plex.Actions ...  
Compiling module Cython.Compiler.Lexicon ...  
Compiling module Cython.Compiler.Scanning ...  
Compiling module Cython.Compiler.Parsing ...  
Compiling module Cython.Compiler.Visitor ...  
Compiling module Cython.Compiler.FlowControl ...  
Compiling module Cython.Compiler.Code ...  
Compiling module Cython.Runtime.refnanny ...  
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'  
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'  
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'  
warning: no files found matching '*.pxd' under directory 'Cython/Utility'  
warning: no files found matching '*.h' under directory 'Cython/Utility'  
warning: no files found matching '.cpp' under directory 'Cython/Utility'  
/tmp/easy_install-VzJ0lH/Cython-0.16/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: El fitxer o directori no existeix  
compilation terminated.  
error: Setup script exited with error: command 'gcc' failed with exit status 1  

カタロニア語で申し訳ありませんが、El fitxer o directori no existeix はファイルが存在しないことを意味します

私はおそらく何かを見逃しているか、わからないと思います

他の誰かが同じ問題を抱えていますか?または正しくインストールする方法を知っていますか?

4

2 に答える 2

11

Python のインストール方法によっては、dev ファイルも取得する必要がある場合があります (apt-get または Synaptic でインストールした場合)。

sudo apt-get install python-dev

または多分

sudo apt-get install python2.6-dev  #substitute your python version here...

これは、Cpython に C 拡張機能をインストールする必要がある場合に必要であることに注意してください。

于 2012-04-23T14:55:54.130 に答える
0

Cython のインストール時にこの問題が発生したことを覚えています。Python インストール フォルダー (この例では Python2.7 を想定) に移動する場合は、C:\Python27\include ディレクトリとそのすべての内容をホーム ディレクトリまたは easy_install を実行しているディレクトリにコピーします。「include」ディレクトリには、コンパイラの C ヘッダー ファイルである「python.h」が含まれています。

そうは言っても、それを行ったとき、そのエラーは解消されましたが、それでも機能しませんでした。

ボナソート。

于 2012-04-23T14:38:46.110 に答える