25👍
Here is the my saved note.
sudo apt-get install libxml2
sudo apt-get install libxslt1.1
sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
sudo apt-get install python-libxml2
sudo apt-get install python-libxslt1
sudo apt-get install python-dev
sudo apt-get install python-setuptools
easy_install lxml
It has worked for my ubuntu 12.10
73👍
Make sure you have enough memory. Try dmesg | tail
to see if it outputs something like:
...
[3778136.277570] Out of memory: Kill process 21267 (cc1) score 557 or sacrifice child
[3778136.277587] Killed process 21267 (cc1) total-vm:365836kB, anon-rss:336228kB, file-rss:0kB
- [Django]-Django abstract models versus regular inheritance
- [Django]-What is the way to ignore/skip some issues from python bandit security issues report?
- [Django]-Setting the selected value on a Django forms.ChoiceField
18👍
According to lxml site you could use such construction:
CFLAGS="-O0" pip install lxml
Note for those installing globally: The proper way to pass environment variables with sudo is after sudo
:
sudo CFLAGS="-O0" pip install lxml
- [Django]-Django Rest Framework and JSONField
- [Django]-The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting
- [Django]-Uwsgi installation error in windows 7
8👍
I met the similar question(error: command ‘gcc’ failed with exit status 4) this morning. It seems you need check your machine’s memory. If the memory is lower than 512M,that may be the cause.Try to close some services temporarily,like apache server,and try “pip install lxml” again.It maybe work!
- [Django]-Django: Reference to an outer query may only be used in a subquery
- [Django]-Django template filters, tags, simple_tags, and inclusion_tags
- [Django]-Django Sessions
3👍
I’ve stumbled with this trouble a couple of times.
Short answer
Python2: $ python2.7 setup.py clean build --with-cython install
Python3: $ pip-3.3 install lxml
Long answer
The hypothesis is that pip install lxml
should work in every environment, regardless if you are using Python2 or Python3.
There’s also Cython
to be considered: You will certainly enjoy lxml
compiled with Cython
due to relevant performance gains.
For reasons unknown to me, the compilation on Python2 does not find Cython.
To be more precise and absolutely explicit about this matter, both commands below DO NOT employ Cython:
# DO NOT use these commands. I repeat: DO NOT use these commands.
$ pip-2.7 install lxml
$ easy_install-2.7 install lxml
So, when using Python2 you have only one alternative, as far as I know, which is: compile from sources, Luke!
# install build environment and dependencies
$ kernel_release=$( uname -r )
$ sudo apt-get install linux-headers-${kernel_release} build-essential -y
$ sudo apt-get install libxml2-dev libxslt1-dev -y
# Download from github and compile from sources
$ git clone --branch lxml-3.2.4 https://github.com/lxml/lxml
$ python2.7 setup.py clean build --with-cython install
- [Django]-VSCode terminal shows incorrect python version and path, launching terminal from anaconda works perfectly
- [Django]-What is the difference render() and redirect() in Django?
- [Django]-How do I call a Django function on button click?
2👍
For ubuntu 12.04 and virtual env:
sudo apt-get install libxml2-dev libxslt-dev
workon some-virt-env
pip install lxml
- [Django]-Django Rest Framework writable nested serializers
- [Django]-Laravel's dd() equivalent in django
- [Django]-Is it possible to decorate include(…) in django urls with login_required?
2👍
Try to disable the C compiler optimizations by setting the FLAGS environment variable
CFLAGS="-O0" pip install lxml
That solves for me without the need of more RAM
- [Django]-How to test "render to template" functions in django? (TDD)
- [Django]-Django ignores router when running tests?
- [Django]-How to Unit test with different settings in Django?