注意:我正在使用virtualenvwrapper。为什么我不能使用`pip install lxml`在virtualenv中工作?
之前激活虚拟环境:
$ pip install lxml
Requirement already satisfied (use --upgrade to upgrade): lxml in /usr/lib/python2.7/dist-packages
Cleaning up...
激活虚拟环境后:
(test-env)$ pip install lxml
force/build/lxml/src/lxml/includes/etree_defs.h:9:31: fatal error:
libxml/xmlversion.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/chaz/dev/envs/test-with-system-python-force/bin/python2
.7 -c "import setuptools;__file__='/home/chaz/dev/envs/test-with-
system-python-force/build/lxml/setup.py';exec(compile(open(__file__).
read().replace('\r\n', '\n'), __file__, 'exec'))" install --record
/tmp/pip-bJ6Q_B-record/install-record.txt --single-version-externally
-managed --install-headers /home/chaz/dev/envs/test-env/include/site/python2.7 failed with error code 1 in
/home/chaz/dev/envs/test-env/build/lxml
Storing complete log in /home/chaz/.pip/pip.log
我以某种方式未能看出这是一个特定的编程问题。恕我直言,这属于http://www.serverfault。com –
@MarkusWMahlberg Virtualenv是一个非常常见的Python实用程序,主要由程序员在开发过程中使用,而不是在部署过程中由系统管理员使用。 lxml非常流行,这种类型的问题并不罕见。我认为这是根据“程序员常用的软件工具”的标准进行的主题。 –
@JeremyBanks我很清楚virtualenv。但我认为我们有一个相当环境相关的问题,并且在serverfault上获得有用答案的机会应该更高。 –