HIT-SCIR/pyltp

python3.8安装pyltp错误

cllx opened this issue · 5 comments

cllx commented

报如下错误

warning C4267: “初始化”: 从“size_t”转换到“unsigned int”,可能丢失数据
error C3861: “convert”: 找不到标识符
Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe' failed with exit status 2
“初始化”: 从“size_t”转换到“unsigned long”,可能丢失数据
ltp\src\srl\DepSRL.cpp(114): warning C4018: “<”: 有符号/无符号不匹配
ltp\src\srl\DepSRL.cpp(124): warning C4018: “<”: 有符号/无符号不匹配
ltp\src\srl\DepSRL.cpp(127): warning C4018: “<”: 有符号/无符号不匹配
请问这种问题要怎么解决啊,弄了两天了都没找到方法

不是不支持VS 2019吗,你可能需要用纯净的环境重新试下。
你可以尝试下我之前的方法,当时打包3.7.3成功的。
#206

python 2.7 安装pyltp出错,linux环境
命令:

sudo pip install pyltp

错误信息:

File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

源不行?怎么办?要不试试源码安装?
执行:

git clone https://github.com/HIT-SCIR/pyltp
cd pyltp
sudo python setup.py install

结果,又报错了:

In file included from /usr/include/python2.7/pyconfig.h:6:0,
                 from patch/include/boost/python/detail/wrap_python.hpp:50,
                 from patch/include/boost/python/detail/prefix.hpp:13,
                 from patch/include/boost/python/args.hpp:8,
                 from patch/include/boost/python.hpp:11,
                 from src/pyltp.cpp:15:
/usr/include/python2.7/pyconfig-64.h:1188:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h:39:0,
                 from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097,
                 from /usr/include/c++/4.8.2/iostream:38,
                 from src/pyltp.cpp:13:
/usr/include/features.h:168:0: note: this is the location of the previous definition
 # define _POSIX_C_SOURCE 200809L
 ^
In file included from /usr/include/python2.7/pyconfig.h:6:0,
                 from patch/include/boost/python/detail/wrap_python.hpp:50,
                 from patch/include/boost/python/detail/prefix.hpp:13,
                 from patch/include/boost/python/args.hpp:8,
                 from patch/include/boost/python.hpp:11,
                 from src/pyltp.cpp:15:
/usr/include/python2.7/pyconfig-64.h:1210:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
 #define _XOPEN_SOURCE 600
 ^
In file included from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h:39:0,
                 from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097,
                 from /usr/include/c++/4.8.2/iostream:38,
                 from src/pyltp.cpp:13:
/usr/include/features.h:170:0: note: this is the location of the previous definition
 # define _XOPEN_SOURCE 700
 ^
src/pyltp.cpp:17:27: fatal error: SplitSentence.h: No such file or directory
 #include "SplitSentence.h"
                           ^
compilation terminated.
error: command 'gcc' failed with exit status 1

算了,一个工具而已,废了老半天的劲,安装失败,不折腾了,bye bye~


不死心,是不是源的速度限制导致?换成清华的源
命令:

sudo pip install pyltp -i https://pypi.tuna.tsinghua.edu.cn/simple/

终于安装完成。。。

用python3.7版本安装不成功,python3.6安装成功。

用python3.7版本安装不成功,python3.6安装成功。

现在支持了吗?

可以自己编译安装