user3798654
user3798654

Reputation: 431

lxml install on Python 3.5.1 error

I just installed Python 3.5.1 on my MAC (latest OSX version). I would like to install lxml but am experiencing an error. I already have lxml functioning within Python 2.7. I tried using the following command:

STATIC_DEPS=true sudo pip install lxml

Per directions I found at http://lxml.de/installation.html However, I received the following message upon install:

George-Mac-Pro:BioasysDB BioASys$ STATIC_DEPS=true sudo pip install lxml
Password:
Requirement already satisfied (use --upgrade to upgrade): lxml in /Library/Python/2.7/site-packages
Cleaning up...

It appears as though lxml wants to install in my preexisting Python 2.7 rather than the newly installed Python 3.5. I also tried typing:

--upgrade 

at the terminal prompt but got the following error message:

George-Mac-Pro:BioasysDB BioASys$ --upgrade
-bash: --upgrade: command not found

If I try to import lxml from within Python 3.5 I get the standard ImportError message:

No module named lxml

Any help on how to install lxml within my newly installed Python 3.5.1 would be greatly appreciated.

Upvotes: 1

Views: 4810

Answers (1)

Mike Müller
Mike Müller

Reputation: 85442

You need to install with pip3:

pip3 install lxml

pip uses Python 2 , while pip3 uses Python 3.

You can check what pip3 you are using:

which pip3

Upvotes: 3

Related Questions