我似乎是許多人努力在windows上安裝gensim的人之一。我瀏覽了無數論壇,但那裏的錯誤海報從未出現過與我的錯誤相符的情況。所以希望有人能指引我正確的方向!Gensim與MinGW
我正在運行Windows Server 2012 R2標準版64位。我已經安裝了MinGW & Anaconda 2.2.0(64位),它隨Python 2.7.9一起提供。
我添加了一個文件distutils.cfg到C:\用戶\ SAM \蟒蛇\ LIB \ distutils的與內容:
[build]
compiler=mingw32
我已經加入C:\ MinGW的\ bin添加到我的環境變量。
如果我安裝gensim使用PIP我沒有得到任何錯誤,直到我試圖運行Word2Vec時,我得到的錯誤:
C:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\gensim\models\word2vec.py:459: UserWarning: C extension com
pilation failed, training will be slow. Install a C compiler and reinstall gensim for fast training.
所以我已經卸載gensim並試圖使用的mingw32重新安裝編譯器,但是這給了我這個錯誤:
python setup.py build --compiler=mingw32
c:\users\sam.passmore\appdata\local\continuum\anaconda\lib\site-packages\setuptools-14.3-py2.7.egg\setuptools\dist.py:282: UserWarni
ng: Normalizing '0.11.1-1' to '0.11.1.post1'
running build
running build_ext
building 'gensim.models.word2vec_inner' extension
C:\MinGW\bin\gcc.exe -DMS_WIN64 -mdll -O -Wall -Igensim\models -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\include -IC:
\Users\sam.passmore\AppData\Local\Continuum\Anaconda\PC -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\n
umpy\core\include -c ./gensim/models/word2vec_inner.c -o build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o
gcc: error: ./gensim/models/word2vec_inner.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
setup.py:82: UserWarning:
********************************************************************
WARNING: %s could not
be compiled. No C extensions are essential for gensim to run,
although they do result in significant speed improvements for some modules.
%s
Here are some hints for popular operating systems:
If you are seeing this message on Linux you probably need to
install GCC and/or the Python development package for your
version of Python.
Debian and Ubuntu users should issue the following command:
$ sudo apt-get install build-essential python-dev
RedHat, CentOS, and Fedora users should issue the following command:
$ sudo yum install gcc python-devel
If you are seeing this message on OSX please read the documentation
here:
http://api.mongodb.org/python/current/installation.html#osx
********************************************************************
The gensim.models.word2vec_inner extension moduleThe output above this warning shows how the compilation failed.
"The output above this warning shows how the compilation failed.")
building 'gensim.models.doc2vec_inner' extension
C:\MinGW\bin\gcc.exe -DMS_WIN64 -mdll -O -Wall -Igensim\models -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\include -IC:
\Users\sam.passmore\AppData\Local\Continuum\Anaconda\PC -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\n
umpy\core\include -c ./gensim/models/doc2vec_inner.c -o build\temp.win-amd64-2.7\Release\.\gensim\models\doc2vec_inner.o
gcc: error: ./gensim/models/doc2vec_inner.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
setup.py:82: UserWarning:
********************************************************************
WARNING: %s could not
be compiled. No C extensions are essential for gensim to run,
although they do result in significant speed improvements for some modules.
%s
Here are some hints for popular operating systems:
If you are seeing this message on Linux you probably need to
install GCC and/or the Python development package for your
version of Python.
Debian and Ubuntu users should issue the following command:
$ sudo apt-get install build-essential python-dev
RedHat, CentOS, and Fedora users should issue the following command:
$ sudo yum install gcc python-devel
If you are seeing this message on OSX please read the documentation
here:
http://api.mongodb.org/python/current/installation.html#osx
********************************************************************
The gensim.models.doc2vec_inner extension moduleThe output above this warning shows how the compilation failed.
"The output above this warning shows how the compilation failed."
我已經用盡了我能想到的或發現所有的選項,因此,如果任何人都可以給一些建議,將不勝感激。
這不是你錯誤的原因,但是如果你想爲64位版本的Python構建C擴展,你需要使用MinGW-w64。 –
你好,感謝您的意見。我遇到的另一個問題是我沒有管理權限。我曾嘗試按@Ross Ridge的建議安裝MinGW-w64,但我只能找到需要該特權的版本。你知道不需要這個的安裝程序嗎? – SamPassmore
如果你下載MinGW-w64的'.tar.bz2'版本,你應該可以把它解壓到你自己的目錄下。你會不知何故說服setup.py使用該版本,而不是安裝在'C:\ MingGW \ bin'中的版本。 –