简体   繁体   English

Gensim未安装-Windows 8.1-Python

[英]Gensim not installing - Windows 8.1 - Python

I am trying to install Gensim but I am getting the errors displayed below. 我正在尝试安装Gensim,但出现以下错误。 I am running Anaconda 2.1.0 with Python 2.7.8 and NumPy 1.9.0 on a Windows 8.1 machine. 我在Windows 8.1机器上运行带有Python 2.7.8和NumPy 1.9.0的Anaconda 2.1.0。 I already have the Windows SDK 8.1. 我已经有Windows SDK 8.1。

It says something about a deprecated NumPy version 1.7, which seems odd because I am running NumPy 1.9.0. 它说明了有关已弃用的NumPy版本1.7的信息,这似乎很奇怪,因为我正在运行NumPy 1.9.0。

I also have a Anaconda3 installation with Python 3.4, though I removed those from my PATH in order to be able to run Python 2 in cmd, because I need to work on a project in Python 2. Running python --version returns "Python 2.7.8". 我还使用Python 3.4安装了Anaconda3,尽管我从PATH中删除了它们,以便能够在cmd中运行Python 2,因为我需要在Python 2中处理项目。运行python --version返回“ Python 2.7 0.8" 。

In [9]: %run setup.py install
running install
running bdist_egg
running egg_info
writing requirements to gensim.egg-info\requires.txt
writing gensim.egg-info\PKG-INFO
writing top-level names to gensim.egg-info\top_level.txt
writing dependency_links to gensim.egg-info\dependency_links.txt
reading manifest file 'gensim.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.sh' under directory '.'
no previously-included directories found matching 'docs\src*'
writing manifest file 'gensim.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'gensim.models.word2vec_inner' extension
C:\Program Files (x86)\Haskell Platform\2013.2.0.0\mingw\bin\gcc.exe -DMS_WIN64
-mdll -O -Wall -IC:\Users\Robert-Jan\Downloads\gensim-0.10.3\gensim-0.10.3\gensi
m\models -IC:\Anaconda\include -IC:\Anaconda\PC -IC:\Anaconda\lib\site-packages\
numpy\core\include -c ./gensim/models/word2vec_inner.c -o build\temp.win-amd64-2
.7\Release\.\gensim\models\word2vec_inner.o
In file included from C:\Anaconda\lib\site-packages\numpy\core\include/numpy/nda
rraytypes.h:1804:0,
                 from C:\Anaconda\lib\site-packages\numpy\core\include/numpy/nda
rrayobject.h:17,
                 from C:\Anaconda\lib\site-packages\numpy\core\include/numpy/arr
ayobject.h:4,
                 from ./gensim/models/word2vec_inner.c:232:
C:\Anaconda\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:
12:9: note: #pragma message: C:\Anaconda\lib\site-packages\numpy\core\include/nu
mpy/npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disa
ble it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
./gensim/models/word2vec_inner.c: In function '__Pyx_RaiseArgtupleInvalid':
./gensim/models/word2vec_inner.c:9761:18: warning: unknown conversion type chara
cter 'z' in format
./gensim/models/word2vec_inner.c:9761:18: warning: format '%.1s' expects type 'c
har *', but argument 5 has type 'Py_ssize_t'
./gensim/models/word2vec_inner.c:9761:18: warning: unknown conversion type chara
cter 'z' in format
./gensim/models/word2vec_inner.c:9761:18: warning: too many arguments for format

./gensim/models/word2vec_inner.c: In function '__Pyx_RaiseTooManyValuesError':
./gensim/models/word2vec_inner.c:10235:18: warning: unknown conversion type char
acter 'z' in format
./gensim/models/word2vec_inner.c:10235:18: warning: too many arguments for forma
t
./gensim/models/word2vec_inner.c: In function '__Pyx_RaiseNeedMoreValuesError':
./gensim/models/word2vec_inner.c:10241:18: warning: unknown conversion type char
acter 'z' in format
./gensim/models/word2vec_inner.c:10241:18: warning: format '%.1s' expects type '
char *', but argument 3 has type 'Py_ssize_t'
./gensim/models/word2vec_inner.c:10241:18: warning: too many arguments for forma
t
./gensim/models/word2vec_inner.c: At top level:
C:\Anaconda\lib\site-packages\numpy\core\include/numpy/__multiarray_api.h:1629:1
: warning: '_import_array' defined but not used
C:\Anaconda\lib\site-packages\numpy\core\include/numpy/__ufunc_api.h:241:1: warn
ing: '_import_umath' defined but not used
./gensim/models/word2vec_inner.c: In function '__pyx_pf_5trunk_6gensim_6models_1
4word2vec_inner_train_sentence_sg':
./gensim/models/word2vec_inner.c:5271:59: warning: '__pyx_v_syn1' may be used un
initialized in this function
./gensim/models/word2vec_inner.c:5274:59: warning: '__pyx_v_syn1neg' may be used
 uninitialized in this function
./gensim/models/word2vec_inner.c:5275:28: warning: '__pyx_v_table' may be used u
ninitialized in this function
./gensim/models/word2vec_inner.c:5276:25: warning: '__pyx_v_table_len' may be us
ed uninitialized in this function
./gensim/models/word2vec_inner.c:5277:25: warning: '__pyx_v_next_random' may be
used uninitialized in this function
./gensim/models/word2vec_inner.c: In function '__pyx_pf_5trunk_6gensim_6models_1
4word2vec_inner_2train_sentence_cbow':
./gensim/models/word2vec_inner.c:6080:59: warning: '__pyx_v_syn1' may be used un
initialized in this function
./gensim/models/word2vec_inner.c:6083:59: warning: '__pyx_v_syn1neg' may be used
 uninitialized in this function
./gensim/models/word2vec_inner.c:6084:28: warning: '__pyx_v_table' may be used u
ninitialized in this function
./gensim/models/word2vec_inner.c:6085:25: warning: '__pyx_v_table_len' may be us
ed uninitialized in this function
./gensim/models/word2vec_inner.c:6086:25: warning: '__pyx_v_next_random' may be
used uninitialized in this function
writing build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.def
C:\Program Files (x86)\Haskell Platform\2013.2.0.0\mingw\bin\dllwrap.exe -DMS_WI
N64 -mdll -static --entry _DllMain@12 --output-lib build\temp.win-amd64-2.7\Rele
ase\.\gensim\models\libword2vec_inner.a --def build\temp.win-amd64-2.7\Release\.
\gensim\models\word2vec_inner.def -s build\temp.win-amd64-2.7\Release\.\gensim\m
odels\word2vec_inner.o -LC:\Anaconda\libs -LC:\Anaconda\PCbuild\amd64 -lpython27
 -lmsvcr90 -o build\lib.win-amd64-2.7\gensim\models\word2vec_inner.pyd
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x23fb): undefined reference to `_imp__PyExc_TypeError'
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x2406): undefined reference to `_imp__PyErr_Format'
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x2447): undefined reference to `_imp__PyDict_Next'
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x246f): undefined reference to `_imp__PyString_Type'
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x24aa): undefined reference to `_imp___PyString_Eq'
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x251f): undefined reference to `_imp___PyString_Eq'
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x2555): undefined reference to `_imp__PyUnicodeUCS2_Compare'
build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o:word2vec_inner
.c:(.text+0x2561): undefined reference to `_imp__PyErr_Occurred'
[...]

...and it goes on throwing up undefined references. ...然后继续抛出未定义的引用。

Turns out the problem was that the C libraries that Gensim needs are being compiled using a program called gcc.dll. 原来的问题是,Gensim所需的C库正在使用名为gcc.dll的程序进行编译。 Anaconda has this program built in, but so does the Haskell platform. Anaconda内置了此程序,Haskell平台也内置了此程序。 As I've been using Haskell a while ago the Python installer was using the Haskell version of gcc.dll, instead of Anaconda's gcc.bat. 正如我前一段时间使用Haskell一样,Python安装程序使用的是Haskell版本的gcc.dll,而不是Anaconda的gcc.bat。

Removing my Haskell installation fixed the problem. 删除我的Haskell安装程序解决了该问题。

I'm using python 3.4 in win64. 我在win64中使用python 3.4。 I met the same error when I install gensim. 安装gensim时遇到相同的错误。 Then aftering trying many methods, I finally made it by "pip uninstall" numpy scipy and gensim, then "pip install" all three .whl files from the following site: http://www.lfd.uci.edu/~gohlke/pythonlibs/ 然后,尝试了许多方法之后,我终于通过“ pip卸载” numpy scipy和gensim使其成功,然后“ pip安装”了来自以下站点的所有三个.whl文件: http ://www.lfd.uci.edu/~gohlke/ pythonlibs /

Hoping can help others :) 希望可以帮助别人:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM