python管道安装包_管道安装lxm

我知道这个问题被问了很多次。我试过所有已知的食谱,但还是有问题。在

所以,我创造了一个清晰的环境。然后pip install lxml出现错误:x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w

In file included from src/lxml/lxml.etree.c:85:0:

/usr/include/python2.7/Python.h:8:22: fatal error: pyconfig.h: No such file or directory

compilation terminated.

Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 1

creating tmp

cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitRwrJxg.c -o tmp/xmlXPathInitRwrJxg.o

/tmp/xmlXPathInitRwrJxg.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]

main (int argc, char **argv) {

^

cc tmp/xmlXPathInitRwrJxg.o -lxml2 -o a.out

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Cleaning up...

Command /home/andriy/PROJECTS/delete/env/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-XHiH0Y/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zuYS3W-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/andriy/PROJECTS/delete/env/include/site/python2.7 failed with error code 1 in /tmp/pip-build-XHiH0Y/lxml

Traceback (most recent call last):

File "/home/andriy/PROJECTS/delete/env/bin/pip", line 11, in

sys.exit(main())

File "/home/andriy/PROJECTS/delete/env/local/lib/python2.7/site-packages/pip/__init__.py", line 248, in main

return command.main(cmd_args)

File "/home/andriy/PROJECTS/delete/env/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main

text = '\n'.join(complete_log)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 68: ordinal not in range(128)

我应该说我已经用Python3成功地安装了lxml。此外,我之前已经成功地将lxml包安装到其他环境中。但现在有东西坏了。在

有什么办法用Python2.7解决它吗?在

这是痛苦的第二天,我要重新安装我的Ubuntu。在

解决方案

下面Padraic Cunningham解决了我的问题。日志直接指出问题是由系统中缺少文件pyconfig.h引起的。它是python-dev包的文件。但是,此软件包已安装。因此,很自然地假设这个包是corrupter,应该用sudo apt-get install --reinstall python-dev libpython2.7-dev重新安装。另外,重新安装了libpython2.7-dev。在文件pyconfig.h出现在正确的位置之后,pip install lxlm成功安装了lxml包。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值