在amazon ec2

时间:2016-06-02 12:40:58

标签: python amazon-ec2 lxml

我在这个主题上看过很多线程,但我仍然无法在Amazon EC2上的python34中安装lxml模块。

我已经使用

安装了请求模块
sudo easy_install-3.4 requests

但是,如果我尝试使用

安装lxml模块
sudo easy_install-3.4 lxml

失败了,我得到了

Searching for lxml
Reading https://pypi.python.org/simple/lxml/
Best match: lxml 3.6.0
Downloading https://pypi.python.org/packages/11/1b/fe6904151b37a0d6da6e60c13583945f8ce3eae8ebd0ec763ce546358947/lxml-3.6.0.tar.gz#md5=5957cc384bd6e83934be35c057ec03b6
Processing lxml-3.6.0.tar.gz
Writing /tmp/easy_install-i92lmsc5/lxml-3.6.0/setup.cfg
Running lxml-3.6.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-i92lmsc5/lxml-3.6.0/egg-dist-tmp-km_e4sdc
Building lxml version 3.6.0.
Building without Cython.
Using build configuration of libxslt 1.1.28
Building against libxml2/libxslt in the following directory: /usr/lib64
unable to execute 'gcc': No such file or directory
Compile failed: command 'gcc' failed with exit status 1
unable to execute 'cc': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: Setup script exited with error: command 'gcc' failed with exit status 1

然后我尝试用:

安装libxml2
sudo yum install libxml2-devel libxslt-devel python-devel

我得到了

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                                                                                                      | 2.1 kB     00:00
amzn-updates/latest                                                                                                                   | 2.3 kB     00:00
Package libxml2-devel-2.9.1-6.2.50.amzn1.x86_64 already installed and latest version
Package libxslt-devel-1.1.28-5.12.amzn1.x86_64 already installed and latest version
Package python26-devel-2.6.9-2.84.amzn1.x86_64 already installed and latest version
Nothing to do

所以如果已经安装了libxml2模块,问题出在哪里?

1 个答案:

答案 0 :(得分:2)

根据以下错误消息,您似乎没有安装编译器。

/usr/lib64 unable to execute 'gcc': No such file or directory

除了开发库之外,您还需要安装编译器。

sudo yum install gcc libxml2-devel libxslt-devel python-devel
sudo easy_install-3.4 lxml