注意:我正在使用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上獲得有用答案的機會應該更高。 –