我正在尝试在virtualenv中使用pypy,以便在运行我的python程序时获得更好的性能。我能够安装所有必需的模块,lxml
到目前为止,我试过了
pip install lxml
也试过
pip install --upgrade lxml
最后显示以下消息:
Successfully installed lxml-3.4.4
但是,当我启动pypy提示并尝试导入lxml时,我收到错误:
(venv)➜ pypy pypy
Python 2.7.3 (2.2.1+dfsg-1ubuntu0.2, Dec 02 2014, 23:00:55)
[PyPy 2.2.1 with GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``denial is rarely a good debugging
technique''
>>>> import lxml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lxml
>>>> from lxml import html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lxml
更新
我正在使用ubuntu 14.04
另外,我试过
sudo apt-get install pypy-dev
答案 0 :(得分:3)
我有类似的问题。我通过运行sudo apt-get install python-dev libxml2 libxml2-dev libxslt-dev
然后pip install --upgrade lxml