2017-04-12 112 views
2

我試圖安裝spacy運行pip install spacy爲蟒蛇版本3.6.1但不斷我得到像下面的錯誤,如何擺脫這個問題?以前我有cl.exe沒有找到錯誤,之後,我添加了cl.exe所在的環境變量中的visual studio路徑。失敗的建設輪for spacy

 Failed building wheel for spacy 
    Running setup.py clean for spacy 
    Running setup.py bdist_wheel for murmurhash ... error 
    Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\murmurhash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpa6tzdkovpip-wheel- --python-tag cp36: 
    running bdist_wheel 
    running build 
    running build_py 
---------------------------------------- 
    Failed building wheel for murmurhash 
    Running setup.py clean for murmurhash 
    Running setup.py bdist_wheel for cymem ... error 
    Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\cymem\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpz7p6hkiwpip-wheel- --python-tag cp36: 

---------------------------------------- 
    Failed building wheel for cymem 
    Running setup.py clean for cymem 
    Running setup.py bdist_wheel for preshed ... error 
    Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\preshed\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpwppgmyp9pip-wheel- --python-tag cp36: 

    ---------------------------------------- 
    Failed building wheel for preshed 
    Running setup.py clean for preshed 
    Running setup.py bdist_wheel for thinc ... error 
---------------------------------------- 
    Failed building wheel for thinc 
    Running setup.py clean for thinc 
    Running setup.py bdist_wheel for ujson ... error 
    ---------------------------------------- 
    Failed building wheel for ujson 
    Running setup.py clean for ujson 
    Running setup.py bdist_wheel for cytoolz ... error 
    ---------------------------------------- 
    Failed building wheel for cytoolz 
    Running setup.py clean for cytoolz 
Failed to build spacy murmurhash cymem preshed thinc ujson cytoolz 
Installing collected packages: murmurhash, cymem, preshed, wrapt, tqdm, toolz, cytoolz, plac, pyreadline, dill, termcolor, pathlib, thinc, ujson, regex, spacy 
    Running setup.py install for murmurhash ... error 

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\sh00428701\appdata\local\programs\python\python36\include -IC:\Users\SH0042~1\AppData\Local\Temp\pip-build-joi6voav\murmurhash\murmurhash\include -Ic:\users\sh00428701\appdata\local\programs\python\python36\include -Ic:\users\sh00428701\appdata\local\programs\python\python36\include /EHsc /Tpmurmurhash/mrmr.cpp /Fobuild\temp.win-amd64-3.6\Release\murmurhash/mrmr.obj /Ox /EHsc 
    mrmr.cpp 
    c1xx: fatal error C1083: Cannot open source file: 'murmurhash/mrmr.cpp': No such file or directory 
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\cl.exe' failed with exit status 2 

    ---------------------------------------- 
Command "c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\murmurhash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SH0042~1\AppData\Local\Temp\pip-_j1cxej1-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SH0042~1\AppData\Local\Temp\pip-build-joi6voav\murmurhash\ 

回答

3

一對夫婦的想法:

+0

第一個選項適用於Windows 64位,Python 2.7。請注意,您還需要cytoolz和ujson來自:https://www.lfd.uci.edu/~gohlke/pythonlibs/ –

+0

老兄,您剛剛在此保存了我的生活。非常感謝你 –

5

我安裝了這些軟件包,那麼它的工作原理:

sudo apt-get install python-dev 
sudo apt-get install python3-dev 
sudo apt-get install libevent-dev 
+0

什麼是Windows的相同呢? – user1761806

+0

什麼等於yum RHEL –

2

對我來說,pip install --no-cache-dir spacy工作

+0

太棒了!我花了數小時試圖弄清楚這一點。這條簡單的小線條讓我非常清楚。謝謝! –

-1

這爲我工作:

# Note, use sudo. I'm in a docker image, so i dont need it. 

# install dev libs 
apt-get install python-dev -y && \ 
apt-get install python3-dev -y && \ 
apt-get install libevent-dev -y && \ 

# install new gcc 
apt-get update && \ 
apt-get install build-essential software-properties-common -y && \ 
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ 
apt-get update && \ 
apt-get install gcc-snapshot -y && \ 
apt-get update && \ 
apt-get install gcc-6 g++-6 -y && \ 
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \ 
apt-get install gcc-4.8 g++-4.8 -y && \ 
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8; 

看到https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91

+0

請不要添加「謝謝」作爲答案。一旦你有足夠的[聲譽](https://stackoverflow.com/help/whats-reputation),你就可以[提出問題和答案](https://stackoverflow.com/help/privileges/vote- )你發現有幫助。 - [來自評論](/ review/low-quality-posts/18758930) –

+0

儘管此鏈接可能會回答問題,但最好在此包含答案的基本部分,並提供供參考的鏈接。如果鏈接頁面更改,則僅鏈接答案可能會失效。 - [來自評論](/ review/low-quality-posts/18758930) – user28434

+0

根據反饋進行更新。 –