Python 3.6.10 is the latest stable version at the time of writing of tutorial. This Python version is available to download and install. This article will help you to install Python 3.6.10 on Ubuntu and Linuxmint operating system. To know more about this version visit Python official website.

Advertisement

Step 1 – Prerequsities

Use the following command to install prerequisites for Python before proceeding to the next steps.

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Step 2 – Download Python 3.6

Download Python using following command from python official site. You can also download the latest version in place of specified below.

cd /usr/src
sudo wget https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tgz

Now extract the downloaded package.

sudo tar xzf Python-3.6.10.tgz

Step 3 – Compile Python Source

Now use below set of commands to compile Python source code on your system. We use --enable-optimizations option with configure command to enable additional supports like SSL, bz2 support. With make command altinstall, to install it as separate Python, This will not overwrite the existing installation.

cd Python-3.6.10
sudo ./configure --enable-optimizations
sudo make altinstall

make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Step 4 – Check the Python Version

Finally, you have successfully installed Python 3.6 on your system. Let’s check the version installed of python using the below command.

python3.6 -V

Python 3.6.10

This will also configure PIP for you to install Python modules.

pip3.6 -V

pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
Share.

56 Comments

  1. Am getting the following error after following all instructions and successful install:

    mike@Mike-Inspiron-Mint:/usr/src/Python-3.6.10$ pip3.6 -V
    bash: pip3.6: command not found

    Please advise….thanks!!

  2. I found the following error:
    The directory ‘/home/haftom/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
    The directory ‘/home/haftom/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

  3. Susi Juniastuti on

    It was helpfully. Very easy. First, I installed Python3.6.1 from cd installer on my pc ,ubuntu 16.04, then process stopped . There were some errors.
    I tried using this tutorial . Works !

    Thanks a lot

  4. I have installed python 3.6.6 successfully on ubuntu 14.04 but PyCharm is not detecting 3.6 as an interpreter.
    Can you please help me with same?

  5. Ömer yalçın on

    Hi Rahul than you for sharing. I setup successfully python 3.6.6 on my pc, because of you , but I can not setup python idle 3.6.6 . When I try setup idle , it was for python 3.6.6 . How I can fix this problem.

  6. Just tried this but it fails
    Checking for python version >= 2.7.0 : 3.6.4
    python-config : /usr/local/bin/python3.6m-config
    Asking python-config for pyembed ‘–cflags –libs –ldflags’ flags : yes
    Testing pyembed configuration : yes
    Asking python-config for pyext ‘–cflags –libs –ldflags’ flags : yes
    Testing pyext configuration : Could not build python extensions
    The configuration failed
    (complete log in /tmp/pip-build-k_6fcvg_/wxPython/build/waf/3.6/gtk3/config.log)
    Command ‘”/usr/local/bin/python3.6″ /tmp/pip-build-k_6fcvg_/wxPython/bin/waf-2.0.7 –wx_config=/tmp/pip-build-k_6fcvg_/wxPython/build/wxbld/gtk3/wx-config –gtk3 –python=”/usr/local/bin/python3.6″ –out=build/waf/3.6/gtk3 configure build ‘ failed with exit code 1.
    Finished command: build_py (0.782s)
    Finished command: build (3m45.45s)
    Command ‘”/usr/local/bin/python3.6″ -u build.py build’ failed with exit code 1.

  7. Hi. i have tried this. Now I have python 2.7, 3.6 and 3.6 in my system. but my Pycharm cannot find the 3.6 in selecting interpreter settings. How can I fix this?

  8. Okay, this is legitimately the best Linux Mint guide I’ve seen on this topic. I never realized this website had actual working installation guides.

  9. Thanks. Seems to work on Linux mint 18.3

    Alias existing:

    $ python

    Refers to v 2.712

    $ python3

    Refers to v 3.52

    Is it safe to replace these aliases with the latest Python version or will this break a lot of things in linux?

  10. Might want to try “sudo make -j altinstall” … The -j option tells make to use all your CPU cores, so it builds faster if you have more than one core.

  11. you should add this to the list of dependencies in step 1 so that lzma package works. I found that python 3.6.3 won’t have lzma support without this. I’m on ubuntu 17.04 btw.

    sudo apt-get install liblzma-dev

      • The latest release is now 3.6.2 and the instructions given above, using the URL you outline but replacing “3.6.0” with “3.6.2” does not work. The error for both “3.6.0” and “3.6.2” is “Python 3.6.x – Permission denied. I did download 3.6.2 and it is in my download folder but I am unable to copy or move it to /usr/src. I am new to Linux so it is undoutedly my inexperience that limits me but I would like to use Python on LinuxMint. Thanks.

          • Thanks. I was using the right click copy & paste to do it. The command line worked. Following the rest of the commands above it extracted and at the end of the ./configure task it indicated that if wanted a release build with all stable optimizations active (PGO, etc) I should run “./configure –enable-optimizations” which I did.

            After running the “sudo make altinstall” command I ran the “Python-3.6 -V” command and got “Command not found”. I cannot find v3.6.2 on the computer. I do find v 2.7.11 and v 3.5 .2. I also find “Idle” for v 2.7.

            I’ll give up on this for now and learn more about LinuxMint before trying again. I have previous experience in programming but trying to get Python 3.6.2 has me frustrated. Thanks.

            • You might have already figured this out, but in case you haven’t – your comment uses an incorrect binary name. You should be able to use the new version by running “python3.6” (so your version check would be “python3.6 -V”, not “Python-3.6 -V”). The rest of this comment is optional; only read if you want a pedantic breakdown of how python versions are managed.

              To paraphrase from the Python-3.6.2/README.rst file:

              >All files and installed using “sudo make altinstall” contain the major and minor version and can thus live side-by-side: “${prefix}/bin/pythonX.Y”.

              >”sudo make install” also creates the symbolic link “${prefix}/bin/python3” which points to “${prefix}/bin/pythonX.Y”.

              An example to illustrate what this means:

              Python 2.7.6 and Python 3.4.3 are installed by default on Ubuntu 14.04. If you run “python”, you enter a Python 2.7.6 prompt – because there is a symlink called “python” pointing to a symlink called “python2” pointing to a binary called “python2.7”. Running “python2” gives the same result, of course. If you run “python3”, you enter a Python 3.4.3 prompt – because there is a symlink called “python3” pointing to a binary called “python3.4”.

              If you follow this page’s instructions and use “make altinstall”, a new binary will be added called “python3.6” Running “python3.6” gives 3.6.2; running “python3.4” gives 3.4.3; running “python3” gives 3.4.3 (because of the symlink).

              If instead you use “make install”, the “python3.6” binary is created, same as before – but in ADDITION to this, the “python3” symlink will be overwritten with one that points to “python3.6”. So running “python3.6” and “python3.4” has the same behavior as before, but now running “python3” gives 3.6.2.

              By default in Ubuntu (and so probably in Linux Mint) the system python links/binaries are in the /usr/bin folder, and it seems like when a user installs Python from source, by default the links/binaries are put in /usr/local/bin.

              So if you’ve used the defaults, you can find most of what you have by running this command: “find /usr/bin /usr/local/bin -iname ‘python*’ -ls” (i.e., find everything in /usr/bin and /usr/local/bin whose name starts with “python” and print the results).

  12. when iam installing python3.6.0,i wrote the command for downloading python version $ cd/usr/src but it showing that such directory was not existing,so what can i do

    • put a space after the “cd” command….you have “cd/usr/src” when it should be “cd /usr/src” – pay close attention to syntax as it will trip you up all the time….

    • Abbas Moghtanei on

      I had the same problem too. What I did was, I used “sudo -s”, and then I was able
      to cd to Python-3.6.0 .

  13. Hi Rahul,
    Python 2.7 was pre -installed on my laptop. I use Ubuntu 16.04

    I downloaded 3.6.0 and followed the steps mentioned by you.
    I encountered no error in any of the steps.
    Yet the version still shows 2.7.

    Help needed. Thanks
    Aikya

Reply To Sky Cancel Reply

Exit mobile version