Gensim和MinGW

2024-09-30 00:24:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我似乎是众多努力在windows上安装gensim的人之一。我浏览了无数的论坛,但那里的错误海报似乎从来没有匹配过我的错误。所以希望有人能给我指出正确的方向!在

我正在运行Windows Server 2012 R2 Standard 64位。我已经安装了python2.7.9附带的MinGW&Anaconda 2.2.0(64位)。在

我添加了一个文件分布.cfg包含以下内容的C:\Users\Sam\Anaconda\Lib\distutils:

[build]
compiler=mingw32

我已经将C:\MinGW\bin添加到环境变量中。在

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

^{pr2}$

因此,我已经卸载了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."

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


Tags: thebuildformodelssamanacondathisusers
1条回答
网友
1楼 · 发布于 2024-09-30 00:24:08

在使用conda安装gensim而不是pip之后,我设法解决了这个问题。在

conda install gensim

我不确定我上面所包含的其他步骤是否有助于得到答案,但这是我在不再收到“安装C编译器并重新安装gensim for fast training”消息之前所做的最后一件事。在

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

^{pr2}$

致分布.cfg并确保MinGW在您的路径中。还要确保MinGW位版本与python版本相同。在

相关问题 更多 >

    热门问题