0

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

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
WRJ
  • 617
  • 3
  • 9
  • 19
  • Possible duplicate of [What is a virtualenv, and why should I use one?](https://stackoverflow.com/questions/41972261/what-is-a-virtualenv-and-why-should-i-use-one) – e4c5 May 29 '17 at 11:35
  • I don't want a virtual environment on my machine, I just want to add the package to a specific install – WRJ May 29 '17 at 11:37
  • well that's misguided. – e4c5 May 29 '17 at 11:38
  • Be that as it may, it's my machine, and I don't want to do it. – WRJ May 29 '17 at 11:38
  • Since noone has packaged python-xmltodict for Python 3 on Ubuntu or Debian you cannot add it with apt-get. If you are using something other than Ubuntu or Debian, tell us - perhaps someone has created a a python-xmltodict package for Python 3 on that distro - Are you open to other suggestions than using apt-get ? – nos May 29 '17 at 11:46
  • Thanks for the clarification of why I can't install with apt-get. I'm open to any suggestions, in fact the more the better because then I have a range of options if I run into this issue again and some of the suggestions don't work for whatever reason! But the less fiddling with files they require the better - all I'm trying to to do is add a single package, a job for which I don't believe an entire reworking of my system is required. My Linux build is Ubuntu – WRJ May 29 '17 at 11:54
  • VE is the way to go, if you don't know or want to use it, choose the correct pip binary. – Pedro Lobito May 29 '17 at 12:14

2 Answers2

1

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...

RandomB
  • 3,367
  • 19
  • 30
0

You could use conda for the installation

conda install -c conda-forge xmltodict=0.11.0

This should work

Adarsh Chavakula
  • 1,509
  • 19
  • 28