Ubuntu – Correct way to install python 2.7 on Ubuntu 17.10

17.10python

I was wondering how to install python2.7 correctly. On my other install zlib doesn't work and pip doesn't install correctly and I was forced to use python3 from the command line.

I have a fresh Ubuntu 17.10 install and would like to be able to use pip and stuff. I think it was because python is installed already in Ubuntu and I installed another version or something because python-based command line tools like volatility worked.

Is there any way to fix it so I can install modules and stuff or use the already installed python from command line?

Best Answer

To install Python 2.7 you simply need to do the following in Ubuntu 17.10 in a terminal (they work beautifully side by side out of the box):

# refreshing the repositories
sudo apt update
# its wise to keep the system up to date!
# you can skip the following line if you not
# want to update all your software
sudo apt upgrade
# installing python 2.7 and pip for it
sudo apt install python2.7 python-pip
# installing python-pip for 3.6
sudo apt install python3-pip

NOTE: Do not try to remove python 3.6 as it will screw up your system

You can call python pip the following way:

# for python 2.7
pip2 install <package>
# for python 3.6
pip install <package>

Using pip without a number would install python 3.6 packages.

Related Question