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/
终于安装完成。。。