如何安装python-pptx?

时间:2015-03-05 05:46:17

标签: python install pip easy-install

按照here的说明执行(我添加了sudo,否则它不起作用):

sudo pip install python-pptx

结果我得到了:

/home/my_name/present/build/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

在互联网上搜索fatal error: libxml/xmlversion.h: No such file or directory我找到了these条建议。据说我需要执行:

sudo apt-get install libxml2-dev libxslt1-dev

如果我执行此操作,我会得到:

Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libxml2/libxml2_2.8.0+dfsg1-5ubuntu2.5_i386.deb  404  Not Found [IP: 2001:67c:1360:8c01::18 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libxslt/libxslt1.1_1.1.26-14ubuntu0.1_i386.deb  404  Not Found [IP: 2001:67c:1360:8c01::18 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libxml2/libxml2-dev_2.8.0+dfsg1-5ubuntu2.5_i386.deb  404  Not Found [IP: 2001:67c:1360:8c01::18 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libxslt/libxslt1-dev_1.1.26-14ubuntu0.1_i386.deb  404  Not Found [IP: 2001:67c:1360:8c01::18 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

在上述错误消息的末尾,我有一个建议(尝试使用--fix-missing)。好的,我尝试使用此选项:

sudo apt-get install libxml2-dev libxslt1-dev --fix-missing

结果我得到了:

Unable to correct missing packages.
E: Aborting install.

我放弃了这种方式并试了easy_install

sudo easy_install python-pptx

结果我得到了:

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt 
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
  warnings.warn(msg)
In file included from src/lxml/lxml.etree.c:239:0:
/tmp/easy_install-XE7O55/lxml-3.4.2/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1

好的,因为建议安装libxml2libxslt,我试试:

sudo easy_install libxml2

结果我得到了:

Searching for libxml2
Reading http://pypi.python.org/simple/libxml2/
Couldn't find index page for 'libxml2' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for libxml2
error: Could not find suitable distribution for          Requirement.parse('libxml2')

0 个答案:

没有答案