HIT-SCIR / pyltp

pyltp: the python extension for LTP
1.53k stars 352 forks source link

Win10安装pyltp出错,The system cannot find the file specified #206

Closed DraculaXly closed 5 years ago

DraculaXly commented 5 years ago

问题

源码编译安装失败

出错场景

按照其他更改两处代码无效 下载文件在本地编译时,总会显示The system cannot find the file specified

代码片段

(base) D:\GitHub\Pyltp\pyltp>python setup.py install running install running bdist_egg running egg_info writing pyltp.egg-info\PKG-INFO writing dependency_links to pyltp.egg-info\dependency_links.txt writing top-level names to pyltp.egg-info\top_level.txt reading manifest file 'pyltp.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '.hpp' under directory 'ltp\src\framework' warning: no files found matching '.hpp' under directory 'ltp\src\segmentor' warning: no files found matching '.hpp' under directory 'ltp\src\postagger' warning: no files found matching '.hpp' under directory 'ltp\src\ner' warning: no files found matching '*.hpp' under directory 'ltp\src\parser.n' writing manifest file 'pyltp.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_ext error: [WinError 2] The system cannot find the file specified

如何复现这一错误

重新下载文件重新安装依旧会出现

运行环境

Win10 + Python 3.7 + VS Build Tool2015

其他

pip安装时错误代码如下,供分析用 Building wheel for pyltp (setup.py) ... error ERROR: Complete output from command 'D:\Anaconda\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\Dracu\AppData\Local\Temp\pip-install-hdps_fzl\pyltp\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\Dracu\AppData\Local\Temp\pip-wheel-_nfm49de' --python-tag cp37: ERROR: running bdist_wheel running build running build_ext error: [WinError 2] The system cannot find the file specified

ERROR: Failed building wheel for pyltp

DraculaXly commented 5 years ago

win10 + python 3.7.3 + VC14

https://github.com/DraculaXly/Python/tree/master/Wheel

三个注意点

  1. 环境需要纯净点的,我有了VS 2019怎么装都是报错,找了个没装过VS的,下载VS Build Tool2015,打包就好了
  2. Win下有GCC错误的,更改distutils.cfg文件为msvc(哈哈,当然只适用于用VC打包的童鞋啦)
  3. 修改patch/libs/python/src/converter/builtin_converters.cpp return (void *)(PyUnicode_Check(obj) ? _PyUnicode_AsString(obj) : 0);