我正在尝试安装textacy来执行NLP任务,但是在尝试执行时出错:
python -m pip install textacy --user
代码开始运行,但一段时间后失败并显示以下输出:
ERROR: Command errored out with exit status 1:
command: 'C:Program Files (x86)Python37-32python.exe' 'C:Users3ORM3OVAppDataRoamingPythonPython37site-packagespip' install --ignore-installed --no-user --prefix 'C:UsersUSER~1AppDataLocalTemppip-build-env-owdv11_anormal' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel 'preshed<3.1.0,>=3.0.2' 'thinc<7.4.0,>=7.3.0' 'murmurhash<1.1.0,>=0.28.0' 'cython>=0.25' 'cymem<2.1.0,>=2.0.2'
cwd: None
Complete output (57 lines):
Collecting wheell
-LINKS TO PACKAGES DELETED SO AS TO BE ABLE TO POST-
Installing collected packages: wheel, cymem, murmurhash, preshed, numpy, blis, wasabi, srsly, plac, tqdm, thinc, cython
Running setup.py install for cymem: started
Running setup.py install for cymem: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'C:Program Files (x86)Python37-32python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\USER~1\AppData\Local\Temp\pip-install-fx2lzonc\cymem\setup.py'"'"'; __file__='"'"'C:\Users\USER~1\AppData\Local\Temp\pip-install-fx2lzonc\cymem\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersUSER~1AppDataLocalTemppip-record-v5xmg2wwinstall-record.txt' --single-version-externally-managed --prefix 'C:UsersUSER~1AppDataLocalTemppip-build-env-owdv11_anormal' --compile
cwd: C:UsersUSER~1AppDataLocalTemppip-install-fx2lzonccymem
Complete output (24 lines):
WARNING: The wheel package is not available.
running install
running build
running build_py
creating build
creating buildlib.win32-3.7
creating buildlib.win32-3.7cymem
copying cymemabout.py -> buildlib.win32-3.7cymem
copying cymem__init__.py -> buildlib.win32-3.7cymem
package init file 'cymemtests__init__.py' not found (or not a regular file)
creating buildlib.win32-3.7cymemtests
copying cymemteststest_import.py -> buildlib.win32-3.7cymemtests
copying cymemcymem.pyx -> buildlib.win32-3.7cymem
copying cymemcymem.pxd -> buildlib.win32-3.7cymem
copying cymem__init__.pxd -> buildlib.win32-3.7cymem
running build_ext
building 'cymem.cymem' extension
creating buildtemp.win32-3.7
creating buildtemp.win32-3.7Release
creating buildtemp.win32-3.7Releasecymem
C:Program Files (x86)Microsoft Visual Studio 14.0VCBINcl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:Program Files (x86)Python37-32include" "-IC:Program Files (x86)Python37-32include" "-IC:Program Files (x86)Python37-32include" "-IC:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE" "-IC:Program Files (x86)Microsoft Visual Studio 14.0VCATLMFCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" /EHsc /Tpcymem/cymem.cpp /Fobuildtemp.win32-3.7Releasecymem/cymem.obj /Ox /EHsc
cymem.cpp
c:program files (x86)python37-32includepyconfig.h(203): fatal error C1083: No se puede abrir el archivo incluir: 'basetsd.h': 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
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:Program Files (x86)Python37-32python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\USER~1\AppData\Local\Temp\pip-install-fx2lzonc\cymem\setup.py'"'"'; __file__='"'"'C:\Users\USER~1\AppData\Local\Temp\pip-install-fx2lzonc\cymem\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersUSER~1AppDataLocalTemppip-record-v5xmg2wwinstall-record.txt' --single-version-externally-managed --prefix 'C:UsersUSER~1AppDataLocalTemppip-build-env-owdv11_anormal' --compile Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:Program Files (x86)Python37-32python.exe' 'C:Users3ORM3OVAppDataRoamingPythonPython37site-packagespip' install --ignore-installed --no-user --prefix 'C:UsersUSER~1AppDataLocalTemppip-build-env-owdv11_anormal' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel 'preshed<3.1.0,>=3.0.2' 'thinc<7.4.0,>=7.3.0' 'murmurhash<1.1.0,>=0.28.0' 'cython>=0.25' 'cymem<2.1.0,>=2.0.2' Check the logs for full command output.>
您是否考虑过尝试在没有--user
标志的情况下跑步?我运行了python -m pip install textacy
并成功安装了。用户前缀可能存在一些问题。
您是否安装了 Visual C++ 14.0 Microsoft?
使用指向 Visual C++ 2015 生成工具的链接。这将在不安装Visual Studio的情况下安装Visual C++ 14.0。
安装后,该命令对我有用。
pip install textacy
重要的是,我从这里找到了答案:画中错误:需要Microsoft视觉C++ 14.0
要使用 conda 安装textacy包,请运行以下命令之一:
conda install -c conda-forge textacy
conda install -c conda-forge/label/cf201901 textacy
conda install -c conda-forge/label/cf202003 textacy
我尝试了上述三个中的以下代码。它对我来说效果很好
conda install -c conda-forge textacy
供参考- https://anaconda.org/conda-forge/textacy
注意-在 anaconda 提示符/cmd 中运行代码