How To Install Python3 On Ubuntu

Insight: Install Python 3.6 on Ubuntu 16.04/Ubuntu 16.10/ 17.04. Python is one of the mostly used high-level programming language. It was created by Guido van Rossum. First version of python was released in 1991. For both Ubuntu and Debian, we have ongoing project goals to make Python 3 the default, preferred Python version in the distros. This means: Python 3 will be the only Python version installed by default. Python 3 will be the only Python version in any installation media (i.e. Image ISOs) Only Python 3 will be allowed on the Ubuntu touch images. How to install Python 3.6.1 in Ubuntu 16.04. Python 3.6.1 is now the latest maintenance release of Python 3.6 and supersedes 3.6.0. Python is a widely used high-level programming language for general-purpose programming. To install Python 3.6 from sources in all major Linux distributions, check out this guide: How to Install Latest Python 3.6 Version in Linux Install Python 3.6 in Ubuntu 14.04 and 16.04 By default, Ubuntu 14.04 and 16.04 ship in with Python 2.7 and Python 3.5.

Active7 months ago
  • How to install Python 3.6.1 in Ubuntu 16.04. Python 3.6.1 is now the latest maintenance release of Python 3.6 and supersedes 3.6.0. Python is a widely used high-level programming language for general-purpose programming. Python 3.6 series comes with new syntax features, such as.
  • On Ubuntu 16.10 and 17.04, you can find Python 3.6 package in the Universe repository and easily install it via apt as shown. $ sudo apt update $ sudo apt install python3.6 To view a list of all Python binaries installed on your system, run the following ls command.
  • To install Python 3.6 from sources in all major Linux distributions, check out this guide: How to Install Latest Python 3.6 Version in Linux Install Python 3.6 in Ubuntu 14.04 and 16.04 By default, Ubuntu 14.04 and 16.04 ship in with Python 2.7 and Python 3.5.

I have both python2.7 and python3.2 installed in Ubuntu 12.04.
The symbolic link python links to python2.7.

How To Install Python3 On Ubuntu

When I type:

It will default install python2 version of package-name.

Some package supports both python2 and python3.
How to install python3 version of package-name via pip?

helloandre
8,5456 gold badges40 silver badges59 bronze badges
kevPython3kev
112k29 gold badges219 silver badges244 bronze badges

16 Answers

You may want to build a virtualenv of python3, then install packages of python3 after activating the virtualenv. So your system won't be messed up :)

This could be something like:

Felix YanFelix Yan
11.3k6 gold badges39 silver badges58 bronze badges

Ubuntu 12.10+ and Fedora 13+ have a package called python3-pip which will install pip-3.2 (or pip-3.3, pip-3.4 or pip3 for newer versions) without needing this jumping through hoops.

I came across this and fixed this without needing the likes of wget or virtualenvs (assuming Ubuntu 12.04):

  1. Install package python3-setuptools: run sudo aptitude install python3-setuptools, this will give you the command easy_install3.
  2. Install pip using Python 3's setuptools: run sudo easy_install3 pip, this will give you the command pip-3.2 like kev's solution.
  3. Install your PyPI packages: run sudo pip-3.2 install <package> (installing python packages into your base system requires root, of course).
  4. Profit!
akaIDIOTakaIDIOT
8,3983 gold badges20 silver badges29 bronze badges

Source: Shashank Bharadwaj's comment

The short answer applies only on newer systems. On some versions of Ubuntu the command is pip-3.2:

If it doesn't work, this method should work for any Linux distro and supported version:

If you don't have curl, use wget. If you don't have sudo, switch to root. If pip3 symlink does not exists, check for something like pip-3.X

Much python packages require also the dev package, so install it too:

Sources:
python installing packages with pip
Pip latest install

Check also Tobu's answer if you want an even more upgraded version of Python.

I want to add that using a virtual environment is usually the preferred way to develop a python application, so @felixyan answer is probably the best in an ideal world. But if you really want to install that package globally, or if need to test / use it frequently without activating a virtual environment, I suppose installing it as a global package is the way to go.

Marco SullaMarco Sulla
8,8406 gold badges32 silver badges56 bronze badges

Well, on ubuntu 13.10/14.04, things are a little different.

Install

Install packages

NOT pip-3.3 install

laike9m
laike9m
9,17610 gold badges70 silver badges96 bronze badges

The easiest way to install latest pip2/pip3 and corresponding packages:

Note: please run these commands as root

kevkev
112k29 gold badges219 silver badges244 bronze badges

I had the same problem while trying to install pylab, and I have found this link

So what I have done to install pylab within Python 3 is:

It has worked properly, and as you can see in the link you can do this for every Python version you have, so I guess this solves your problem.

lmiguelvargasflmiguelvargasf
17k16 gold badges102 silver badges118 bronze badges

Old question, but none of the answers satisfies me. One of my systems is running Ubuntu 12.04 LTS and for some reason there's no package python3-pip or python-pip for Python 3. So here is what I've done (all commands were executed as root):

  • Install setuptools for Python3 in case you haven't.

    • This means 10% of your posts/comments can serve as self promotion. Opening • • In order to link to your own website/channel/blog, you maintain a ratio of 9 non-promotional post for each one that does serve promotional purposes.

    or

  • With Python 2.4+ you can invoke easy_install with specific Python version by using python -m easy_install. So pip for Python 3 could be installed by:

  • That's it, you got pip for Python 3. Now just invoke pip with the specific version of Python to install package for Python 3. For example, with Python 3.2 installed on my system, I used:

Ha-Duong NguyenHa-Duong Nguyen
7891 gold badge11 silver badges21 bronze badges

If you have pip installed in both pythons, and both are in your path, just use:

References:

This is a duplicate of question #2812520

Community
Hugo TavaresHugo Tavares
17.6k5 gold badges39 silver badges42 bronze badges

If your system has python2 as default, use below command to install packages to python3

$ python3 -m pip install <package-name>

ketankkketankk
1,7051 gold badge19 silver badges23 bronze badges

Easy enough:

How To Install Python 3 On Ubuntu Live Cd

If you want Python 3.3, which isn't the default as of Ubuntu 12.10:

Tobu

How To Install Python 3 On Ubuntu Download

Tobu
21k3 gold badges74 silver badges91 bronze badges

You can alternatively just run pip3 install packagename instead of pip,

How To Install Python 3 On Ubuntu Forums

FahtimaFahtima

Clonedvd crack. Firstly, you need to install pip for the Python 3 installation that you want. Then you run that pip to install packages for that Python version.

Since you have both pip and python 3 in /usr/bin, I assume they are both installed with a package manager of some sort. That package manager should also have a Python 3 pip. That's the one you should install.

Felix' recommendation of virtualenv is a good one. If you are only testing, or you are doing development, then you shouldn't install the package in the system python. Using virtualenv, or even building your own Pythons for development, is better in those cases.

But if you actually do want to install this package in the system python, installing pip for Python 3 is the way to go.

How To Install Python 3 On Ubuntu Mate

Lennart RegebroLennart Regebro
121k34 gold badges192 silver badges232 bronze badges

Although the question relates to Ubuntu, let me contribute by saying that I'm on Mac and my python command defaults to Python 2.7.5. I have Python 3 as well, accessible via python3, so knowing the pip package origin, I just downloaded it and issued sudo python3 setup.py install against it and, surely enough, only Python 3 has now this module inside its site packages. Hope this helps a wandering Mac-stranger.

NixterNixter

Execute the pip binary directly.

First locate the version of PIP you want.

Then execute.

jonnymacjonnymac
  1. You should install ALL dependencies:

    sudo apt-get install build-essential python3-dev python3-setuptools python3-numpy python3-scipy libatlas-dev libatlas3gf-base

  2. Install pip3(if you have installed, please look step 3):

    sudo apt-get install python3-pip

  3. Iinstall scikit-learn by pip3

    pip3 install -U scikit-learn

  4. Open your terminal and entry python3 environment, type import sklearn to check it.

Gook Luck!

Manish Kothari
1,3601 gold badge17 silver badges30 bronze badges
CristinaoCristinao

Another way to install python3 is using wget. Below are the steps for installation.

Also,one can create an alias for the same using

How To Install Python On Ubuntu Visual Studio

Now open a new terminal and type py and press Enter.

arpiagar

Ubuntu Install Python 3.6

arpiagar

How To Install Python In Ubuntu

1,9861 gold badge14 silver badges12 bronze badges

How To Install Python 3 On Ubuntu 17.04

Not the answer you're looking for? Browse other questions tagged pythonubuntupython-3.xubuntu-12.04pip or ask your own question.