2

I understand that in Ubuntu 14.04, you have access to both python 2.7.6 and python 3.4.0. When getting python packages through the command line, how do I make sure that I am installing packages meant for python 2.7.6 and not for python 3.4.0?

4

Use apt-file to find out the package name. For example if you want to install the right version of reportlab use:

apt-file -l search reportlab

On my system this produces:

gambas3-gb-report
python-mvpa2
python-pdfrw
python-pisa
python-renderpm
python-renderpm-dbg
python-reportlab
python-reportlab-accel
python-reportlab-accel-dbg
python-reportlab-doc
python3-renderpm
python3-renderpm-dbg
python3-reportlab
python3-reportlab-accel
python3-reportlab-accel-dbg

It is fair to assume that package python-reportlab is the 2.7 version and package python3-reportlab is the python 3.x version. If however you want to check that further you can use dpkg -L python-reportlab — this will list the package contents and you will see that the files are in /usr/lib/python2.7.

Unfortunately the dpkg -L works only on installed packages so if you want to check it before you install the package you will have to use the Ubuntu packages web interface. Once you open a package details page you can click on list of files and find out whether the files are in /usr/lib/python2.7 or in /usr/lib/python3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.