Add package to specific install of Python in Linux

185 Views Asked by At

I am trying to add xmltodict package to Python on Linux.

I have 2 installations of Python on my Linux build; Python 2.7 (default) and Python 3.5 (in the form of an Anaconda installation). I want to add xmltodict to the Python 3 installation, but when I use sudo apt-get install python-xmltodict it adds it to the default Python 2.7 installation.

How can I get apt to add this package to my Python 3 installation without changing the default or using pip? I do not want to have to rebuild my installation with a virtual environment either

2

There are 2 best solutions below

1
On BEST ANSWER

You could use conda for the installation

conda install -c conda-forge xmltodict=0.11.0

This should work

0
On

if you want to do it with pip or easy-install, you can run pip2/pip2.7 and install it. It will be installed for Python which was used to run pip...