Home > Net >  How to specify the Python version I want to install lxml in?
How to specify the Python version I want to install lxml in?

Time:09-21

I am new to Linux. On my Oracle Virtual Machine, I have several versions of Python installed.

Now I would like to install the lxml library in my Python 3.7, but I don't know how to specify the terminal to do so. The command pip install lxml that was recommanded to me returns : Requirement already satisfied : lxml in <my path to Python 3.8>

What I understand is that by default, it installs lxml in Python 3.8. How can I change that into Python 3.7 please ?

CodePudding user response:

You must know how to start the Python3.7 version. If you start it with full_path_to_python37, then you should use the following to install lxml in it:

full_path_to_python37 -m pip install lxml

CodePudding user response:

How can I change that into Python 3.7 please ?

According to python docs regarding working with multiple versions of python installed in parallel you might

On Linux, Mac OS X, and other POSIX systems, use the versioned Python commands in combination with the -m switch to run the appropriate copy of pip

so in your case

python3.7 -m pip install lxml
  • Related