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?

  • I'm using 17.10. I want to use the command line version and install libraries but I'm not sure how. Nov 28, 2017 at 20:10

1 Answer 1


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.

  • 1
    so deceptively simple... sudo apt update was necessary on an clean installation of 18.04 to get python-pip to install.
    – srage
    Feb 12, 2020 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .