Download Python 2.7 For Ubuntu 18.04

And choose download from main server. Sudo apt update && sudo apt install python-dev. Both ways change the apt sources to main server. Improve this answer. Follow this answer to receive notifications. Answered Nov 1 '19 at 17:09. Ubuntu 18.04 ships with Python 3, as the default Python installation. Complete the following steps to install pip ( pip3) for Python 3: Start by updating the package list using the following command: sudo apt update. Use the following command to install pip for Python 3: sudo apt install python3-pip.


Download python 2.7 for ubuntu 18.04 usb

In this tutorial We will learn to setup OpenCV-Python in Ubuntu System. Below steps are tested for Ubuntu 16.04 and 18.04 (both 64-bit).

OpenCV-Python can be installed in Ubuntu in two ways:

  • Install from pre-built binaries available in Ubuntu repositories
  • Compile from the source. In this section, we will see both.

Download Page for python2.72.7.17-118.04ubuntu1.6amd64.deb on AMD64 machines If you are running Ubuntu, it is strongly suggested to use a package manager like aptitude or synaptic to download and install packages, instead of doing so manually via this website. Download python2.7 packages for Debian, Fedora, Ubuntu. Ubuntu Main amd64 Official python2.72.7.15rc1-1amd64.deb: Interactive high-level object-oriented language (version 2.7).

Another important thing is the additional libraries required. OpenCV-Python requires only Numpy (in addition to other dependencies, which we will see later). But in this tutorials, we also use Matplotlib for some easy and nice plotting purposes (which I feel much better compared to OpenCV). Matplotlib is optional, but highly recommended. Similarly we will also see IPython, an Interactive Python Terminal, which is also highly recommended.

Installing OpenCV-Python from Pre-built Binaries

This method serves best when using just for programming and developing OpenCV applications.

Install package python3-opencv with following command in terminal (as root user).

Open Python IDLE (or IPython) and type following codes in Python terminal.


If the results are printed out without any errors, congratulations !!! You have installed OpenCV-Python successfully.

It is quite easy. But there is a problem with this. Apt repositories may not contain the latest version of OpenCV always. For example, at the time of writing this tutorial, apt repository contains 2.4.8 while latest OpenCV version is 3.x. With respect to Python API, latest version will always contain much better support and latest bug fixes.

So for getting latest source codes preference is next method, i.e. compiling from source. Also at some point in time, if you want to contribute to OpenCV, you will need this.

Building OpenCV from source

Compiling from source may seem a little complicated at first, but once you succeeded in it, there is nothing complicated.

First we will install some dependencies. Some are required, some are optional. You can skip optional dependencies if you don't want.

Required build dependencies

We need CMake to configure the installation, GCC for compilation, Python-devel and Numpy for building Python bindings etc.

sudo apt-get install gcc g++

to support python2:

to support python3:

Next we need GTK support for GUI features, Camera support (v4l), Media Support (ffmpeg, gstreamer) etc.

sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev

to support gtk2:

to support gtk3:

Optional Dependencies

Above dependencies are sufficient to install OpenCV in your Ubuntu machine. But depending upon your requirements, you may need some extra dependencies. A list of such optional dependencies are given below. You can either leave it or install it, your call :)

OpenCV comes with supporting files for image formats like PNG, JPEG, JPEG2000, TIFF, WebP etc. But it may be a little old. If you want to get latest libraries, you can install development files for system libraries of these formats.

sudo apt-get install libjpeg-dev
sudo apt-get install libtiff-dev
If you are using Ubuntu 16.04 you can also install libjasper-dev to add a system level support for the JPEG2000 format.

Download Python 2.7 For Ubuntu 18.04 Windows 10

Downloading OpenCV

To download the latest source from OpenCV's GitHub Repository. (If you want to contribute to OpenCV choose this. For that, you need to install Git first)

$ git clone

It will create a folder 'opencv' in current directory. The cloning may take some time depending upon your internet connection.

Now open a terminal window and navigate to the downloaded 'opencv' folder. Create a new 'build' folder and navigate to it.

$ cd build

Configuring and Installing

Now we have all the required dependencies, let's install OpenCV. Installation has to be configured with CMake. It specifies which modules are to be installed, installation path, which additional libraries to be used, whether documentation and examples to be compiled etc. Most of this work are done automatically with well configured default parameters.

Below command is normally used for configuration of OpenCV library build (executed from build folder):

OpenCV defaults assume 'Release' build type and installation path is '/usr/local'. For additional information about CMake options refer to OpenCV C++ compilation guide:

You should see these lines in your CMake output (they mean that Python is properly found):

-- Interpreter: /usr/bin/python2.7 (ver 2.7.6)
-- Libraries: /usr/lib/x86_64-linux-gnu/ (ver 2.7.6)
-- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)
-- Interpreter: /usr/bin/python3.4 (ver 3.4.3)
-- Libraries: /usr/lib/x86_64-linux-gnu/ (ver 3.4.3)
-- numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.8.2)

Now you build the files using 'make' command and install it using 'make install' command.

Python For Ubuntu Download

# sudo make install

Installation is over. All files are installed in '/usr/local/' folder. Open a terminal and try import 'cv2'.

Active1 year, 11 months ago

is there a way to install Python 2.7 on Ubuntu 18.04? I tried this command but it isn't working.

Is there a way to install it manually? I try python 2.7 for a software that didn't support python 3.


Kevin JedynakKevin Jedynak

Run these commands to ensure your repositories are up to date before installing

Then to install pip for python 2:


As my comment has solved the issue, I will develop it a little more in this answer for further reference.

Try using aptitude, it better manage conflicting packages for you:


JonaDownload python 2.7 for ubuntu 18.04 usb

Install Python 2.7 Ubuntu 18.04 Command Line

1,1021 gold badge8 silver badges19 bronze badges

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