我有Python 3.6.5并且我正在尝试通过pip安装spaCy,它在尝试编译murmurhash.mrmr扩展时抛出以下错误:
C:\Users\muthu>pip install C:\Users\muthu\Downloads\Installers\en_core_web_sm-2.0.0.tar.gz --no-cache-dir
Processing c:\users\muthu\downloads\installers\en_core_web_sm-2.0.0.tar.gz
Collecting spacy>=2.0.0a18 (from en-core-web-sm==2.0.0)
Downloading spacy-2.0.11.tar.gz (17.6MB)
100% |████████████████████████████████| 17.6MB 1.2MB/s
Requirement already satisfied: numpy>=1.7 in c:\users\muthu\appdata\local\programs\python\python36-32\lib\site-packages (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Collecting murmurhash<0.29,>=0.28 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading murmurhash-0.28.0.tar.gz
Collecting cymem<1.32,>=1.30 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading cymem-1.31.2.tar.gz
Collecting preshed<2.0.0,>=1.0.0 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading preshed-1.0.0.tar.gz (89kB)
100% |████████████████████████████████| 92kB 1.0MB/s
Collecting thinc<6.11.0,>=6.10.1 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading thinc-6.10.2.tar.gz (1.2MB)
100% |████████████████████████████████| 1.2MB 786kB/s
Collecting plac<1.0.0,>=0.9.6 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading plac-0.9.6-py2.py3-none-any.whl
Collecting pathlib (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading pathlib-1.0.1.tar.gz (49kB)
100% |████████████████████████████████| 51kB 629kB/s
Collecting ujson>=1.35 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading ujson-1.35.tar.gz (192kB)
100% |████████████████████████████████| 194kB 695kB/s
Collecting dill<0.3,>=0.2 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading dill-0.2.7.1.tar.gz (64kB)
100% |████████████████████████████████| 71kB 950kB/s
Collecting regex==2017.4.5 (from spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading regex-2017.04.05-cp36-none-win32.whl (237kB)
100% |████████████████████████████████| 245kB 910kB/s
Requirement already satisfied: wrapt in c:\users\muthu\appdata\local\programs\python\python36-32\lib\site-packages (from thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Collecting tqdm<5.0.0,>=4.10.0 (from thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading tqdm-4.21.0-py2.py3-none-any.whl (42kB)
100% |████████████████████████████████| 51kB 893kB/s
Collecting cytoolz<0.9,>=0.8 (from thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading cytoolz-0.8.2.tar.gz (386kB)
100% |████████████████████████████████| 389kB 741kB/s
Requirement already satisfied: six<2.0.0,>=1.10.0 in c:\users\muthu\appdata\local\programs\python\python36-32\lib\site-packages (from thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Collecting termcolor (from thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading termcolor-1.1.0.tar.gz
Collecting msgpack-python (from thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading msgpack-python-0.5.6.tar.gz (138kB)
100% |████████████████████████████████| 143kB 774kB/s
Collecting msgpack-numpy==0.4.1 (from thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading msgpack_numpy-0.4.1-py2.py3-none-any.whl
Collecting pyreadline>=1.7.1 (from dill<0.3,>=0.2->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading pyreadline-2.1.zip (109kB)
100% |████████████████████████████████| 112kB 768kB/s
Collecting toolz>=0.8.0 (from cytoolz<0.9,>=0.8->thinc<6.11.0,>=6.10.1->spacy>=2.0.0a18->en-core-web-sm==2.0.0)
Downloading toolz-0.9.0.tar.gz (45kB)
100% |████████████████████████████████| 51kB 1.2MB/s
Installing collected packages: murmurhash, cymem, preshed, tqdm, toolz, cytoolz, plac, pyreadline, dill, termcolor, pathlib, msgpack-python, msgpack-numpy, thinc, ujson, regex, spacy, en-core-web-sm
Running setup.py install for murmurhash ... error
Complete output from command c:\users\muthu\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\muthu\\AppData\\Local\\Temp\\pip-build-biubjhck\\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\muthu\AppData\Local\Temp\pip-tvo0bjqa-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.6
creating build\lib.win32-3.6\murmurhash
copying murmurhash\about.py -> build\lib.win32-3.6\murmurhash
copying murmurhash\__init__.py -> build\lib.win32-3.6\murmurhash
creating build\lib.win32-3.6\murmurhash\tests
copying murmurhash\tests\test_import.py -> build\lib.win32-3.6\murmurhash\tests
copying murmurhash\tests\__init__.py -> build\lib.win32-3.6\murmurhash\tests
copying murmurhash\mrmr.pyx -> build\lib.win32-3.6\murmurhash
copying murmurhash\mrmr.pxd -> build\lib.win32-3.6\murmurhash
copying murmurhash\__init__.pxd -> build\lib.win32-3.6\murmurhash
creating build\lib.win32-3.6\murmurhash\include
creating build\lib.win32-3.6\murmurhash\include\murmurhash
copying murmurhash\include\murmurhash\MurmurHash2.h -> build\lib.win32-3.6\murmurhash\include\murmurhash
copying murmurhash\include\murmurhash\MurmurHash3.h -> build\lib.win32-3.6\murmurhash\include\murmurhash
running build_ext
building 'murmurhash.mrmr' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "c:\users\muthu\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\muthu\\AppData\\Local\\Temp\\pip-build-biubjhck\\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\muthu\AppData\Local\Temp\pip-tvo0bjqa-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\muthu\AppData\Local\Temp\pip-build-biubjhck\murmurhash\
然后我从http://landinghub.visualstudio.com/visual-cpp-build-tools安装了“Microsoft Visual C ++ Build Tools”(虽然我有VS2012 !!!),安装顺利!
打开新的命令提示符并重试pip,给出vs安装路径的路径并重试等等。每次它给我同样的错误。不知道我在这里缺少什么:(
感谢任何帮助。
答案 0 :(得分:3)
如果您遇到困难并且无法编译,您可以在此处找到所有相关库的预编译轮安装程序:https://www.lfd.uci.edu/~gohlke/pythonlibs/
您可以下载该文件,然后执行pip install path/to/file.whl
,它应该可以正常运行。
你也可以尝试使用conda,然后从conda-forge频道安装。
答案 1 :(得分:1)
我花了一天时间试图修复它。我的解决方案是使用Update 3安装Visual Studio 2015(确保安装了Microsoft Visual C ++ 2015 Redistributable(x86) - 14 ....如果你有旧版本但是你已经拥有Microsoft Visual C ++并不重要2017年,那将阻止你安装C ++ 2015)。 安装VS2015时,在功能选项卡中,确保勾选Windows和Web开发框,以便安装它(Spacy安装) 没有它就行不通) 安装完成后,以管理员身份运行命令提示符(我使用Anaconda Prompt)并继续运行“pip install -U spacy”。
仅供参考,我使用了Anaconda Prompt,Window 10,Python 3.6.2,我在Anaconda virtenv上安装了Spacy。希望这会有所帮助。