首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gensim与MinGW

Gensim与MinGW
EN

Stack Overflow用户
提问于 2015-06-22 03:55:48
回答 1查看 2K关注 0票数 0

我似乎是许多在windows上安装gensim的人中的一员。我已经在无数的论坛上摸索过,但是那里的错误招贴画似乎永远都比不上我的错误。希望有人能给我指明正确的方向!

我正在运行Windows 2012 R2标准64位.我已经安装了MinGW &Anaconda2.2.0(64位),它附带了Python2.7.9。

我在C:\ distutils.cfg \Sam\Anaconda\Lib\distutils中添加了一个文件,内容如下:

代码语言:javascript
复制
[build]
compiler=mingw32

我在我的环境变量中添加了C:\MinGW\bin。

如果我使用pip安装gensim,我不会得到任何错误,直到我尝试运行Word2Vec时,我得到了错误:

代码语言:javascript
复制
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编译器重新安装,但是这给了我这个错误:

代码语言:javascript
复制
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."

我已经用尽了所有我能想到或找到的选择,所以如果有人能给我一些建议,我将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-22 00:24:30

在使用(而不是pip )之后,我设法解决了这个问题。

代码语言:javascript
复制
conda install gensim

我不知道上面包含的其他步骤对答案有什么帮助,但这是我在不再获得“安装C编译器并重新安装gensim以便快速培训”之前所做的最后一件事。消息。

在我试图解决这个问题的研究中,我发现最常见的方法是添加行。

代码语言:javascript
复制
[build]
compiler=mingw32

到distutils.cfg文件,并确保MinGW在您的路径中。还确保MinGW位版本与您的python版本相同。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30971935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档