How do I install Python 3.6 using apt-get?











up vote
310
down vote

favorite
125












I've tried the normal way, sudo apt-get install python3.6, but... well... that didn't work.



So, how would I go about it? (I'd preferably not build it on my own)



I'm using Ubuntu 16.04.










share|improve this question




















  • 4




    Maybe python 3.6 is not available for your distribution. If you have installed aptitude, run aptitude search python3
    – ridgy
    Dec 28 '16 at 20:13















up vote
310
down vote

favorite
125












I've tried the normal way, sudo apt-get install python3.6, but... well... that didn't work.



So, how would I go about it? (I'd preferably not build it on my own)



I'm using Ubuntu 16.04.










share|improve this question




















  • 4




    Maybe python 3.6 is not available for your distribution. If you have installed aptitude, run aptitude search python3
    – ridgy
    Dec 28 '16 at 20:13













up vote
310
down vote

favorite
125









up vote
310
down vote

favorite
125






125





I've tried the normal way, sudo apt-get install python3.6, but... well... that didn't work.



So, how would I go about it? (I'd preferably not build it on my own)



I'm using Ubuntu 16.04.










share|improve this question















I've tried the normal way, sudo apt-get install python3.6, but... well... that didn't work.



So, how would I go about it? (I'd preferably not build it on my own)



I'm using Ubuntu 16.04.







apt software-installation python3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 21 at 17:26









muru

135k19288488




135k19288488










asked Dec 28 '16 at 19:52









Olian04

1,6783512




1,6783512








  • 4




    Maybe python 3.6 is not available for your distribution. If you have installed aptitude, run aptitude search python3
    – ridgy
    Dec 28 '16 at 20:13














  • 4




    Maybe python 3.6 is not available for your distribution. If you have installed aptitude, run aptitude search python3
    – ridgy
    Dec 28 '16 at 20:13








4




4




Maybe python 3.6 is not available for your distribution. If you have installed aptitude, run aptitude search python3
– ridgy
Dec 28 '16 at 20:13




Maybe python 3.6 is not available for your distribution. If you have installed aptitude, run aptitude search python3
– ridgy
Dec 28 '16 at 20:13










7 Answers
7






active

oldest

votes

















up vote
452
down vote



accepted










Ubuntu 14.04 (Trusty), 16.04 (Xenial)



If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull's deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:



sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6


Alternatively, you can use J Fernyhough's PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:



sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6


Ubuntu 16.10, 17.04



If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:



sudo apt-get update
sudo apt-get install python3.6


After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04



To invoke the Python 3.6 interpreter, run python3.6.



Ubuntu 17.10 and 18.04 (Bionic)



Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.






share|improve this answer



















  • 4




    Note that python3.6 in Ubuntu 16.10 is a beta version that has some problems (like a very painful memory leak in dict that shows up in some rare circumstances).
    – Marius Gedminas
    Dec 29 '16 at 14:40






  • 88




    CAUTION - Do not under any circumstances be tempted to run sudo apt remove python3.5 or anything like it; Python is more fundamentally baked into Ubuntu than you would think, and you could break your Ubuntu install. If you want python3 to map to python3.6, create a symlink instead!
    – Huw Walters
    Apr 28 '17 at 9:09








  • 15




    I see there is no python3.6-pip package, and so I used curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 to install pip.
    – A-B-B
    Jun 20 '17 at 20:26






  • 5




    Somehow python from ppa:jonathonf/python-3.6 arrived with broken pip and no easy_install on 14.04. However, I've managed to fix it by installing easy_install and then reinstalling pip via curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip Just in case someone runs into the same problem...
    – FirefoxMetzger
    Dec 3 '17 at 17:36






  • 3




    Like some other commenters above, I also had trouble getting pip to install with ppa:jonathonf/python-3.6. On the other hand, ppa:deadsnakes/ppa worked flawlessly (apt-get install python3.6 python3.6-venv -y).
    – Michael Herrmann
    Feb 26 at 16:00


















up vote
118
down vote













I would recommend pyenv to solve your woes. It doesn't use Aptitude, and does involve "building it yourself", but it's fully automated. You can build and install a new (or old) version of Python by simply saying pyenv install 3.6.0. Everything runs as your user, so you don't have to worry about messing up the Python used by Ubuntu itself.



Plus, the answer to the follow-up question "How do I install Python 3.7 using apt-get?" has the same answer: pyenv update; pyenv install 3.7.0. It will generally work same day of a release because you don't need to wait for someone else to package it for Ubuntu. See all the versions you can install with pyenv install --list



Install pyenv





  1. Install tools and headers needed to build CPythons (exotic Pythons like PyPy or Jython may have other dependencies). Git is used by pyenv, plus it also enables builds/installs of source branches, so you could install whatever 3.8 is right now, i.e. the master branch of CPython fresh off GitHub:



    sudo apt-get install -y git
    sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev
    libffi-dev libsqlite3-dev tk-dev

    # optional scientific package headers (for Numpy, Matplotlib, SciPy, etc.)
    sudo apt-get install -y libpng-dev libfreetype6-dev



  2. Run the installer script (installs pyenv and some very useful pyenv plugins by the original author; see here for more)



    curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash



  3. Add init lines to your ~/.profile or ~/.bashrc (it mentions it at the end of the install script):



    export PATH="~/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"


  4. Restart your shell (close & open or exec $SHELL) or reload the profile script. (with e.g. source ~/.bashrc)



Done!



Setting up an environment



To not touch the system Python (generally a bad idea; OS-level services might be relying on some specific library versions, etc.) make your own environment, it's easy! Even better, no sudo, for it or pip installs!





  1. Install your preferred Python version (this will download the source and build it for your user, no input required)



    pyenv install 3.6.0



  2. Make it a virtualenv so you can make others later if you want



    pyenv virtualenv 3.6.0 general



  3. Make it globally active (for your user)



    pyenv global general


  4. Do what you want to with the Python/pip, etc. It's yours.



If you want to clean out your libraries later, you could delete the virtualenv (pyenv uninstall general) or make a new one (pyenv virtualenv 3.6.0 other_proj). You can also have environments active per-directory: pyenv local other_proj will drop a .python-version file into your current folder and any time you invoke Python or pip-installed Python utilities from it or under it, they will be shimmed by pyenv.



Troubleshooting





  • bash: pyenv: command not found, fish: Unknown command 'pyenv'




    1. Check your $PATH, there should be one entry that ends in something like .pyenv/bin. If it's missing make sure you followed #3 AND #4 (restart your shell) under Install pyenv above.




  • pyenv: no such command 'virtualenv'




    1. If you didn't use the installer script, you likely only installed the root pyenv package. See pyenv-virtualenv for instructions to add the plugin

    2. If you used the installer script, check if it shows up with pyenv commands.








share|improve this answer



















  • 1




    There's one caveat, when using pyenv with Python 2.x (or very old 3.x releases before the new Unicode string internal representation happened): pyenv uses the default upstream compilation flags and builds with 16-bit Unicode strings. Linux distros generally build with 32-bit Unicode strings. This causes pain when you pip install some stuff into both pyenv and non-pyenv Pythons, because the of pip wheel caching.
    – Marius Gedminas
    Jan 10 '17 at 8:34










  • @marius why would you ever use a non-pyenv version after installing it?
    – Nick T
    Jan 10 '17 at 14:34






  • 3




    I don't know, but I discovered this issue by helping someone on IRC debug a problem where a particular Python package (lxml?) failed to work due to this. So it happens in practice, to some people, and is worth knowing. (The workaround is rm -r ~/.cache/pip/wheels/.)
    – Marius Gedminas
    Jan 11 '17 at 6:30






  • 1




    Does pyenv need to be installed for every user which need Python? And if I have 3 users who need same Python 3.6 version, then it'll have to compile it 3 times and it will take 3x disk space? If that's true then it sucks… :/
    – Sarge Borsch
    Jun 25 '17 at 11:54






  • 1




    @SargeBorsch by default (if you use pyenv-installer) it's a user install, but there's nothing preventing you from installing it to /opt or whatever and adding some symlinks to /bin. I find it being user-only to be extremely useful; users don't need sudo (other than libs). Disk space is cheap.
    – Nick T
    Jun 25 '17 at 15:30


















up vote
13
down vote













An alternative route if you can't find any working repos would be you could try compiling yourself from source. You can find the source code on the download page. Then download and untar the tarball; for example for Python-3.6.1.tgz.



The process for untarring the tgz file is:



tar -xvzf /path/to/yourfile.tgz


Once you are in the file path the file was unzipped to, run:



./configure
make
make altinstall


And hopefully this should solve the problem for you.






share|improve this answer



















  • 4




    Question says (id preferably not build it on my own). Maybe it'd be better to go the apt route if possible.
    – TheWanderer
    Dec 28 '16 at 20:11










  • Ok, I'll have a look see if I can find any alternative repositories for you. Did you get a chance to look on Google for alternative repos yourself yet? I don't want to suggest things you've already tried.
    – Just In Time Berlake
    Dec 28 '16 at 20:13










  • I'm not the OP. Just making a suggestion. I couldn't find any PPAs for 3.6, so building might be the necessary route. You should probably address that in your answer though.
    – TheWanderer
    Dec 28 '16 at 20:14










  • Your make commands will fail on a system that the user has never built anything, as there are many packages required. "sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev"
    – Joe
    Apr 27 at 15:43




















up vote
9
down vote













It depends on which version of Ubuntu you are using.



Ubuntu 16.10 and Ubuntu 17.04



Since Python 3.6 is installed in the universe repository of Ubuntu 16.10 and Ubuntu 17.04, you can directly install python 3.6 from the repository. Just use the commands below:



sudo apt update
sudo apt install python3.6


Ubuntu 16.04



There are two ways to install Python3.6 on Ubuntu 16.04




  • Compile and install python 3.6 on Ubuntu 16.04

  • Install python 3.6 on Ubuntu 16.04 from PPA


1. Compile and install python 3.6 on Ubuntu 16.04



Install the necessary dependencies, download the python 3.6 source code, and build the environment and install



sudo apt install build-essential checkinstall
sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xvf Python-3.6.0.tar.xz
cd Python-3.6.0/
./configure
sudo make altinstall


2. Install python 3.6 on Ubuntu 16.04 from PPA



You can install Python 3.6  from PPA using the commands below



sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt update
sudo apt install python3.6


If Python 3.6 is correctly installed, you can invoke the python interpreter by running python3.6 in the terminal.



I hope this helps. If you are having any issues, you can check this blog post here.






share|improve this answer

















  • 2




    This is essentially a copy of the accepted answer. Where is the added valuee of your answer?
    – Marc Vanhoomissen
    Jan 4 at 19:28






  • 2




    The first step in the Ubuntu 16.04 is for those who want to compile and install python 3.6 for some reason. The process of compile and install Python 3.6 on Ubuntu 16.04 isn't available in the accepted answer or any answer in the thread for that matter. The other points are to make clear the version of Ubuntu and how it differs from other accepted answers.
    – Aryal Bibek
    Jan 5 at 6:01










  • PPA installs on 16.04 (Mint) appear broken. The installation from source info is useful.
    – demented hedgehog
    May 7 at 22:46


















up vote
4
down vote













For Ubuntu 15.10 I installed it successfully using this method:



sudo add-apt-repository ppa:jonathonf/python-3.6


But I edited this file:



sudo vi /etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-wily.list


And I changed wily to trusty and then:



sudo apt-get update
sudo apt-get install python3.6





share|improve this answer



















  • 11




    Ubuntu 15.10? It has gone EOL months ago. Time to upgrade.
    – edwinksl
    Jun 14 '17 at 7:19


















up vote
2
down vote













Consider pyenv + pipenv which is to replace using PIP + virtual environments using Pipfile



Then in Pipfile



[requires]
python_version = "3.6"


https://stackoverflow.com/a/49800061/1689770






share|improve this answer




























    up vote
    0
    down vote













    First, follow some of the other answers to install Python 3.6 or 3.7. Then, if want to install PyPi packages such as OpenEXR through pip you may get some errors. Some of them (e.g. for OpenEXR's PyPi package) might get resolved by installing Python development package for your newly-installed Python. This can be done using the followings:



    sudo apt-get install python3.6-dev



    or



    sudo apt-get install python3.7-dev






    share|improve this answer






















      protected by Community Mar 13 at 13:11



      Thank you for your interest in this question.
      Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



      Would you like to answer one of these unanswered questions instead?














      7 Answers
      7






      active

      oldest

      votes








      7 Answers
      7






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      452
      down vote



      accepted










      Ubuntu 14.04 (Trusty), 16.04 (Xenial)



      If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull's deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:



      sudo add-apt-repository ppa:deadsnakes/ppa
      sudo apt-get update
      sudo apt-get install python3.6


      Alternatively, you can use J Fernyhough's PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt-get update
      sudo apt-get install python3.6


      Ubuntu 16.10, 17.04



      If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:



      sudo apt-get update
      sudo apt-get install python3.6


      After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04



      To invoke the Python 3.6 interpreter, run python3.6.



      Ubuntu 17.10 and 18.04 (Bionic)



      Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.






      share|improve this answer



















      • 4




        Note that python3.6 in Ubuntu 16.10 is a beta version that has some problems (like a very painful memory leak in dict that shows up in some rare circumstances).
        – Marius Gedminas
        Dec 29 '16 at 14:40






      • 88




        CAUTION - Do not under any circumstances be tempted to run sudo apt remove python3.5 or anything like it; Python is more fundamentally baked into Ubuntu than you would think, and you could break your Ubuntu install. If you want python3 to map to python3.6, create a symlink instead!
        – Huw Walters
        Apr 28 '17 at 9:09








      • 15




        I see there is no python3.6-pip package, and so I used curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 to install pip.
        – A-B-B
        Jun 20 '17 at 20:26






      • 5




        Somehow python from ppa:jonathonf/python-3.6 arrived with broken pip and no easy_install on 14.04. However, I've managed to fix it by installing easy_install and then reinstalling pip via curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip Just in case someone runs into the same problem...
        – FirefoxMetzger
        Dec 3 '17 at 17:36






      • 3




        Like some other commenters above, I also had trouble getting pip to install with ppa:jonathonf/python-3.6. On the other hand, ppa:deadsnakes/ppa worked flawlessly (apt-get install python3.6 python3.6-venv -y).
        – Michael Herrmann
        Feb 26 at 16:00















      up vote
      452
      down vote



      accepted










      Ubuntu 14.04 (Trusty), 16.04 (Xenial)



      If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull's deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:



      sudo add-apt-repository ppa:deadsnakes/ppa
      sudo apt-get update
      sudo apt-get install python3.6


      Alternatively, you can use J Fernyhough's PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt-get update
      sudo apt-get install python3.6


      Ubuntu 16.10, 17.04



      If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:



      sudo apt-get update
      sudo apt-get install python3.6


      After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04



      To invoke the Python 3.6 interpreter, run python3.6.



      Ubuntu 17.10 and 18.04 (Bionic)



      Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.






      share|improve this answer



















      • 4




        Note that python3.6 in Ubuntu 16.10 is a beta version that has some problems (like a very painful memory leak in dict that shows up in some rare circumstances).
        – Marius Gedminas
        Dec 29 '16 at 14:40






      • 88




        CAUTION - Do not under any circumstances be tempted to run sudo apt remove python3.5 or anything like it; Python is more fundamentally baked into Ubuntu than you would think, and you could break your Ubuntu install. If you want python3 to map to python3.6, create a symlink instead!
        – Huw Walters
        Apr 28 '17 at 9:09








      • 15




        I see there is no python3.6-pip package, and so I used curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 to install pip.
        – A-B-B
        Jun 20 '17 at 20:26






      • 5




        Somehow python from ppa:jonathonf/python-3.6 arrived with broken pip and no easy_install on 14.04. However, I've managed to fix it by installing easy_install and then reinstalling pip via curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip Just in case someone runs into the same problem...
        – FirefoxMetzger
        Dec 3 '17 at 17:36






      • 3




        Like some other commenters above, I also had trouble getting pip to install with ppa:jonathonf/python-3.6. On the other hand, ppa:deadsnakes/ppa worked flawlessly (apt-get install python3.6 python3.6-venv -y).
        – Michael Herrmann
        Feb 26 at 16:00













      up vote
      452
      down vote



      accepted







      up vote
      452
      down vote



      accepted






      Ubuntu 14.04 (Trusty), 16.04 (Xenial)



      If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull's deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:



      sudo add-apt-repository ppa:deadsnakes/ppa
      sudo apt-get update
      sudo apt-get install python3.6


      Alternatively, you can use J Fernyhough's PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt-get update
      sudo apt-get install python3.6


      Ubuntu 16.10, 17.04



      If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:



      sudo apt-get update
      sudo apt-get install python3.6


      After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04



      To invoke the Python 3.6 interpreter, run python3.6.



      Ubuntu 17.10 and 18.04 (Bionic)



      Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.






      share|improve this answer














      Ubuntu 14.04 (Trusty), 16.04 (Xenial)



      If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull's deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:



      sudo add-apt-repository ppa:deadsnakes/ppa
      sudo apt-get update
      sudo apt-get install python3.6


      Alternatively, you can use J Fernyhough's PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt-get update
      sudo apt-get install python3.6


      Ubuntu 16.10, 17.04



      If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:



      sudo apt-get update
      sudo apt-get install python3.6


      After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04



      To invoke the Python 3.6 interpreter, run python3.6.



      Ubuntu 17.10 and 18.04 (Bionic)



      Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Dec 7 at 22:39

























      answered Dec 28 '16 at 20:26









      edwinksl

      16.5k115385




      16.5k115385








      • 4




        Note that python3.6 in Ubuntu 16.10 is a beta version that has some problems (like a very painful memory leak in dict that shows up in some rare circumstances).
        – Marius Gedminas
        Dec 29 '16 at 14:40






      • 88




        CAUTION - Do not under any circumstances be tempted to run sudo apt remove python3.5 or anything like it; Python is more fundamentally baked into Ubuntu than you would think, and you could break your Ubuntu install. If you want python3 to map to python3.6, create a symlink instead!
        – Huw Walters
        Apr 28 '17 at 9:09








      • 15




        I see there is no python3.6-pip package, and so I used curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 to install pip.
        – A-B-B
        Jun 20 '17 at 20:26






      • 5




        Somehow python from ppa:jonathonf/python-3.6 arrived with broken pip and no easy_install on 14.04. However, I've managed to fix it by installing easy_install and then reinstalling pip via curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip Just in case someone runs into the same problem...
        – FirefoxMetzger
        Dec 3 '17 at 17:36






      • 3




        Like some other commenters above, I also had trouble getting pip to install with ppa:jonathonf/python-3.6. On the other hand, ppa:deadsnakes/ppa worked flawlessly (apt-get install python3.6 python3.6-venv -y).
        – Michael Herrmann
        Feb 26 at 16:00














      • 4




        Note that python3.6 in Ubuntu 16.10 is a beta version that has some problems (like a very painful memory leak in dict that shows up in some rare circumstances).
        – Marius Gedminas
        Dec 29 '16 at 14:40






      • 88




        CAUTION - Do not under any circumstances be tempted to run sudo apt remove python3.5 or anything like it; Python is more fundamentally baked into Ubuntu than you would think, and you could break your Ubuntu install. If you want python3 to map to python3.6, create a symlink instead!
        – Huw Walters
        Apr 28 '17 at 9:09








      • 15




        I see there is no python3.6-pip package, and so I used curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 to install pip.
        – A-B-B
        Jun 20 '17 at 20:26






      • 5




        Somehow python from ppa:jonathonf/python-3.6 arrived with broken pip and no easy_install on 14.04. However, I've managed to fix it by installing easy_install and then reinstalling pip via curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip Just in case someone runs into the same problem...
        – FirefoxMetzger
        Dec 3 '17 at 17:36






      • 3




        Like some other commenters above, I also had trouble getting pip to install with ppa:jonathonf/python-3.6. On the other hand, ppa:deadsnakes/ppa worked flawlessly (apt-get install python3.6 python3.6-venv -y).
        – Michael Herrmann
        Feb 26 at 16:00








      4




      4




      Note that python3.6 in Ubuntu 16.10 is a beta version that has some problems (like a very painful memory leak in dict that shows up in some rare circumstances).
      – Marius Gedminas
      Dec 29 '16 at 14:40




      Note that python3.6 in Ubuntu 16.10 is a beta version that has some problems (like a very painful memory leak in dict that shows up in some rare circumstances).
      – Marius Gedminas
      Dec 29 '16 at 14:40




      88




      88




      CAUTION - Do not under any circumstances be tempted to run sudo apt remove python3.5 or anything like it; Python is more fundamentally baked into Ubuntu than you would think, and you could break your Ubuntu install. If you want python3 to map to python3.6, create a symlink instead!
      – Huw Walters
      Apr 28 '17 at 9:09






      CAUTION - Do not under any circumstances be tempted to run sudo apt remove python3.5 or anything like it; Python is more fundamentally baked into Ubuntu than you would think, and you could break your Ubuntu install. If you want python3 to map to python3.6, create a symlink instead!
      – Huw Walters
      Apr 28 '17 at 9:09






      15




      15




      I see there is no python3.6-pip package, and so I used curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 to install pip.
      – A-B-B
      Jun 20 '17 at 20:26




      I see there is no python3.6-pip package, and so I used curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 to install pip.
      – A-B-B
      Jun 20 '17 at 20:26




      5




      5




      Somehow python from ppa:jonathonf/python-3.6 arrived with broken pip and no easy_install on 14.04. However, I've managed to fix it by installing easy_install and then reinstalling pip via curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip Just in case someone runs into the same problem...
      – FirefoxMetzger
      Dec 3 '17 at 17:36




      Somehow python from ppa:jonathonf/python-3.6 arrived with broken pip and no easy_install on 14.04. However, I've managed to fix it by installing easy_install and then reinstalling pip via curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip Just in case someone runs into the same problem...
      – FirefoxMetzger
      Dec 3 '17 at 17:36




      3




      3




      Like some other commenters above, I also had trouble getting pip to install with ppa:jonathonf/python-3.6. On the other hand, ppa:deadsnakes/ppa worked flawlessly (apt-get install python3.6 python3.6-venv -y).
      – Michael Herrmann
      Feb 26 at 16:00




      Like some other commenters above, I also had trouble getting pip to install with ppa:jonathonf/python-3.6. On the other hand, ppa:deadsnakes/ppa worked flawlessly (apt-get install python3.6 python3.6-venv -y).
      – Michael Herrmann
      Feb 26 at 16:00












      up vote
      118
      down vote













      I would recommend pyenv to solve your woes. It doesn't use Aptitude, and does involve "building it yourself", but it's fully automated. You can build and install a new (or old) version of Python by simply saying pyenv install 3.6.0. Everything runs as your user, so you don't have to worry about messing up the Python used by Ubuntu itself.



      Plus, the answer to the follow-up question "How do I install Python 3.7 using apt-get?" has the same answer: pyenv update; pyenv install 3.7.0. It will generally work same day of a release because you don't need to wait for someone else to package it for Ubuntu. See all the versions you can install with pyenv install --list



      Install pyenv





      1. Install tools and headers needed to build CPythons (exotic Pythons like PyPy or Jython may have other dependencies). Git is used by pyenv, plus it also enables builds/installs of source branches, so you could install whatever 3.8 is right now, i.e. the master branch of CPython fresh off GitHub:



        sudo apt-get install -y git
        sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev
        libffi-dev libsqlite3-dev tk-dev

        # optional scientific package headers (for Numpy, Matplotlib, SciPy, etc.)
        sudo apt-get install -y libpng-dev libfreetype6-dev



      2. Run the installer script (installs pyenv and some very useful pyenv plugins by the original author; see here for more)



        curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash



      3. Add init lines to your ~/.profile or ~/.bashrc (it mentions it at the end of the install script):



        export PATH="~/.pyenv/bin:$PATH"
        eval "$(pyenv init -)"
        eval "$(pyenv virtualenv-init -)"


      4. Restart your shell (close & open or exec $SHELL) or reload the profile script. (with e.g. source ~/.bashrc)



      Done!



      Setting up an environment



      To not touch the system Python (generally a bad idea; OS-level services might be relying on some specific library versions, etc.) make your own environment, it's easy! Even better, no sudo, for it or pip installs!





      1. Install your preferred Python version (this will download the source and build it for your user, no input required)



        pyenv install 3.6.0



      2. Make it a virtualenv so you can make others later if you want



        pyenv virtualenv 3.6.0 general



      3. Make it globally active (for your user)



        pyenv global general


      4. Do what you want to with the Python/pip, etc. It's yours.



      If you want to clean out your libraries later, you could delete the virtualenv (pyenv uninstall general) or make a new one (pyenv virtualenv 3.6.0 other_proj). You can also have environments active per-directory: pyenv local other_proj will drop a .python-version file into your current folder and any time you invoke Python or pip-installed Python utilities from it or under it, they will be shimmed by pyenv.



      Troubleshooting





      • bash: pyenv: command not found, fish: Unknown command 'pyenv'




        1. Check your $PATH, there should be one entry that ends in something like .pyenv/bin. If it's missing make sure you followed #3 AND #4 (restart your shell) under Install pyenv above.




      • pyenv: no such command 'virtualenv'




        1. If you didn't use the installer script, you likely only installed the root pyenv package. See pyenv-virtualenv for instructions to add the plugin

        2. If you used the installer script, check if it shows up with pyenv commands.








      share|improve this answer



















      • 1




        There's one caveat, when using pyenv with Python 2.x (or very old 3.x releases before the new Unicode string internal representation happened): pyenv uses the default upstream compilation flags and builds with 16-bit Unicode strings. Linux distros generally build with 32-bit Unicode strings. This causes pain when you pip install some stuff into both pyenv and non-pyenv Pythons, because the of pip wheel caching.
        – Marius Gedminas
        Jan 10 '17 at 8:34










      • @marius why would you ever use a non-pyenv version after installing it?
        – Nick T
        Jan 10 '17 at 14:34






      • 3




        I don't know, but I discovered this issue by helping someone on IRC debug a problem where a particular Python package (lxml?) failed to work due to this. So it happens in practice, to some people, and is worth knowing. (The workaround is rm -r ~/.cache/pip/wheels/.)
        – Marius Gedminas
        Jan 11 '17 at 6:30






      • 1




        Does pyenv need to be installed for every user which need Python? And if I have 3 users who need same Python 3.6 version, then it'll have to compile it 3 times and it will take 3x disk space? If that's true then it sucks… :/
        – Sarge Borsch
        Jun 25 '17 at 11:54






      • 1




        @SargeBorsch by default (if you use pyenv-installer) it's a user install, but there's nothing preventing you from installing it to /opt or whatever and adding some symlinks to /bin. I find it being user-only to be extremely useful; users don't need sudo (other than libs). Disk space is cheap.
        – Nick T
        Jun 25 '17 at 15:30















      up vote
      118
      down vote













      I would recommend pyenv to solve your woes. It doesn't use Aptitude, and does involve "building it yourself", but it's fully automated. You can build and install a new (or old) version of Python by simply saying pyenv install 3.6.0. Everything runs as your user, so you don't have to worry about messing up the Python used by Ubuntu itself.



      Plus, the answer to the follow-up question "How do I install Python 3.7 using apt-get?" has the same answer: pyenv update; pyenv install 3.7.0. It will generally work same day of a release because you don't need to wait for someone else to package it for Ubuntu. See all the versions you can install with pyenv install --list



      Install pyenv





      1. Install tools and headers needed to build CPythons (exotic Pythons like PyPy or Jython may have other dependencies). Git is used by pyenv, plus it also enables builds/installs of source branches, so you could install whatever 3.8 is right now, i.e. the master branch of CPython fresh off GitHub:



        sudo apt-get install -y git
        sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev
        libffi-dev libsqlite3-dev tk-dev

        # optional scientific package headers (for Numpy, Matplotlib, SciPy, etc.)
        sudo apt-get install -y libpng-dev libfreetype6-dev



      2. Run the installer script (installs pyenv and some very useful pyenv plugins by the original author; see here for more)



        curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash



      3. Add init lines to your ~/.profile or ~/.bashrc (it mentions it at the end of the install script):



        export PATH="~/.pyenv/bin:$PATH"
        eval "$(pyenv init -)"
        eval "$(pyenv virtualenv-init -)"


      4. Restart your shell (close & open or exec $SHELL) or reload the profile script. (with e.g. source ~/.bashrc)



      Done!



      Setting up an environment



      To not touch the system Python (generally a bad idea; OS-level services might be relying on some specific library versions, etc.) make your own environment, it's easy! Even better, no sudo, for it or pip installs!





      1. Install your preferred Python version (this will download the source and build it for your user, no input required)



        pyenv install 3.6.0



      2. Make it a virtualenv so you can make others later if you want



        pyenv virtualenv 3.6.0 general



      3. Make it globally active (for your user)



        pyenv global general


      4. Do what you want to with the Python/pip, etc. It's yours.



      If you want to clean out your libraries later, you could delete the virtualenv (pyenv uninstall general) or make a new one (pyenv virtualenv 3.6.0 other_proj). You can also have environments active per-directory: pyenv local other_proj will drop a .python-version file into your current folder and any time you invoke Python or pip-installed Python utilities from it or under it, they will be shimmed by pyenv.



      Troubleshooting





      • bash: pyenv: command not found, fish: Unknown command 'pyenv'




        1. Check your $PATH, there should be one entry that ends in something like .pyenv/bin. If it's missing make sure you followed #3 AND #4 (restart your shell) under Install pyenv above.




      • pyenv: no such command 'virtualenv'




        1. If you didn't use the installer script, you likely only installed the root pyenv package. See pyenv-virtualenv for instructions to add the plugin

        2. If you used the installer script, check if it shows up with pyenv commands.








      share|improve this answer



















      • 1




        There's one caveat, when using pyenv with Python 2.x (or very old 3.x releases before the new Unicode string internal representation happened): pyenv uses the default upstream compilation flags and builds with 16-bit Unicode strings. Linux distros generally build with 32-bit Unicode strings. This causes pain when you pip install some stuff into both pyenv and non-pyenv Pythons, because the of pip wheel caching.
        – Marius Gedminas
        Jan 10 '17 at 8:34










      • @marius why would you ever use a non-pyenv version after installing it?
        – Nick T
        Jan 10 '17 at 14:34






      • 3




        I don't know, but I discovered this issue by helping someone on IRC debug a problem where a particular Python package (lxml?) failed to work due to this. So it happens in practice, to some people, and is worth knowing. (The workaround is rm -r ~/.cache/pip/wheels/.)
        – Marius Gedminas
        Jan 11 '17 at 6:30






      • 1




        Does pyenv need to be installed for every user which need Python? And if I have 3 users who need same Python 3.6 version, then it'll have to compile it 3 times and it will take 3x disk space? If that's true then it sucks… :/
        – Sarge Borsch
        Jun 25 '17 at 11:54






      • 1




        @SargeBorsch by default (if you use pyenv-installer) it's a user install, but there's nothing preventing you from installing it to /opt or whatever and adding some symlinks to /bin. I find it being user-only to be extremely useful; users don't need sudo (other than libs). Disk space is cheap.
        – Nick T
        Jun 25 '17 at 15:30













      up vote
      118
      down vote










      up vote
      118
      down vote









      I would recommend pyenv to solve your woes. It doesn't use Aptitude, and does involve "building it yourself", but it's fully automated. You can build and install a new (or old) version of Python by simply saying pyenv install 3.6.0. Everything runs as your user, so you don't have to worry about messing up the Python used by Ubuntu itself.



      Plus, the answer to the follow-up question "How do I install Python 3.7 using apt-get?" has the same answer: pyenv update; pyenv install 3.7.0. It will generally work same day of a release because you don't need to wait for someone else to package it for Ubuntu. See all the versions you can install with pyenv install --list



      Install pyenv





      1. Install tools and headers needed to build CPythons (exotic Pythons like PyPy or Jython may have other dependencies). Git is used by pyenv, plus it also enables builds/installs of source branches, so you could install whatever 3.8 is right now, i.e. the master branch of CPython fresh off GitHub:



        sudo apt-get install -y git
        sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev
        libffi-dev libsqlite3-dev tk-dev

        # optional scientific package headers (for Numpy, Matplotlib, SciPy, etc.)
        sudo apt-get install -y libpng-dev libfreetype6-dev



      2. Run the installer script (installs pyenv and some very useful pyenv plugins by the original author; see here for more)



        curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash



      3. Add init lines to your ~/.profile or ~/.bashrc (it mentions it at the end of the install script):



        export PATH="~/.pyenv/bin:$PATH"
        eval "$(pyenv init -)"
        eval "$(pyenv virtualenv-init -)"


      4. Restart your shell (close & open or exec $SHELL) or reload the profile script. (with e.g. source ~/.bashrc)



      Done!



      Setting up an environment



      To not touch the system Python (generally a bad idea; OS-level services might be relying on some specific library versions, etc.) make your own environment, it's easy! Even better, no sudo, for it or pip installs!





      1. Install your preferred Python version (this will download the source and build it for your user, no input required)



        pyenv install 3.6.0



      2. Make it a virtualenv so you can make others later if you want



        pyenv virtualenv 3.6.0 general



      3. Make it globally active (for your user)



        pyenv global general


      4. Do what you want to with the Python/pip, etc. It's yours.



      If you want to clean out your libraries later, you could delete the virtualenv (pyenv uninstall general) or make a new one (pyenv virtualenv 3.6.0 other_proj). You can also have environments active per-directory: pyenv local other_proj will drop a .python-version file into your current folder and any time you invoke Python or pip-installed Python utilities from it or under it, they will be shimmed by pyenv.



      Troubleshooting





      • bash: pyenv: command not found, fish: Unknown command 'pyenv'




        1. Check your $PATH, there should be one entry that ends in something like .pyenv/bin. If it's missing make sure you followed #3 AND #4 (restart your shell) under Install pyenv above.




      • pyenv: no such command 'virtualenv'




        1. If you didn't use the installer script, you likely only installed the root pyenv package. See pyenv-virtualenv for instructions to add the plugin

        2. If you used the installer script, check if it shows up with pyenv commands.








      share|improve this answer














      I would recommend pyenv to solve your woes. It doesn't use Aptitude, and does involve "building it yourself", but it's fully automated. You can build and install a new (or old) version of Python by simply saying pyenv install 3.6.0. Everything runs as your user, so you don't have to worry about messing up the Python used by Ubuntu itself.



      Plus, the answer to the follow-up question "How do I install Python 3.7 using apt-get?" has the same answer: pyenv update; pyenv install 3.7.0. It will generally work same day of a release because you don't need to wait for someone else to package it for Ubuntu. See all the versions you can install with pyenv install --list



      Install pyenv





      1. Install tools and headers needed to build CPythons (exotic Pythons like PyPy or Jython may have other dependencies). Git is used by pyenv, plus it also enables builds/installs of source branches, so you could install whatever 3.8 is right now, i.e. the master branch of CPython fresh off GitHub:



        sudo apt-get install -y git
        sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev
        libffi-dev libsqlite3-dev tk-dev

        # optional scientific package headers (for Numpy, Matplotlib, SciPy, etc.)
        sudo apt-get install -y libpng-dev libfreetype6-dev



      2. Run the installer script (installs pyenv and some very useful pyenv plugins by the original author; see here for more)



        curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash



      3. Add init lines to your ~/.profile or ~/.bashrc (it mentions it at the end of the install script):



        export PATH="~/.pyenv/bin:$PATH"
        eval "$(pyenv init -)"
        eval "$(pyenv virtualenv-init -)"


      4. Restart your shell (close & open or exec $SHELL) or reload the profile script. (with e.g. source ~/.bashrc)



      Done!



      Setting up an environment



      To not touch the system Python (generally a bad idea; OS-level services might be relying on some specific library versions, etc.) make your own environment, it's easy! Even better, no sudo, for it or pip installs!





      1. Install your preferred Python version (this will download the source and build it for your user, no input required)



        pyenv install 3.6.0



      2. Make it a virtualenv so you can make others later if you want



        pyenv virtualenv 3.6.0 general



      3. Make it globally active (for your user)



        pyenv global general


      4. Do what you want to with the Python/pip, etc. It's yours.



      If you want to clean out your libraries later, you could delete the virtualenv (pyenv uninstall general) or make a new one (pyenv virtualenv 3.6.0 other_proj). You can also have environments active per-directory: pyenv local other_proj will drop a .python-version file into your current folder and any time you invoke Python or pip-installed Python utilities from it or under it, they will be shimmed by pyenv.



      Troubleshooting





      • bash: pyenv: command not found, fish: Unknown command 'pyenv'




        1. Check your $PATH, there should be one entry that ends in something like .pyenv/bin. If it's missing make sure you followed #3 AND #4 (restart your shell) under Install pyenv above.




      • pyenv: no such command 'virtualenv'




        1. If you didn't use the installer script, you likely only installed the root pyenv package. See pyenv-virtualenv for instructions to add the plugin

        2. If you used the installer script, check if it shows up with pyenv commands.









      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Nov 28 at 16:15

























      answered Dec 29 '16 at 2:46









      Nick T

      1,59221227




      1,59221227








      • 1




        There's one caveat, when using pyenv with Python 2.x (or very old 3.x releases before the new Unicode string internal representation happened): pyenv uses the default upstream compilation flags and builds with 16-bit Unicode strings. Linux distros generally build with 32-bit Unicode strings. This causes pain when you pip install some stuff into both pyenv and non-pyenv Pythons, because the of pip wheel caching.
        – Marius Gedminas
        Jan 10 '17 at 8:34










      • @marius why would you ever use a non-pyenv version after installing it?
        – Nick T
        Jan 10 '17 at 14:34






      • 3




        I don't know, but I discovered this issue by helping someone on IRC debug a problem where a particular Python package (lxml?) failed to work due to this. So it happens in practice, to some people, and is worth knowing. (The workaround is rm -r ~/.cache/pip/wheels/.)
        – Marius Gedminas
        Jan 11 '17 at 6:30






      • 1




        Does pyenv need to be installed for every user which need Python? And if I have 3 users who need same Python 3.6 version, then it'll have to compile it 3 times and it will take 3x disk space? If that's true then it sucks… :/
        – Sarge Borsch
        Jun 25 '17 at 11:54






      • 1




        @SargeBorsch by default (if you use pyenv-installer) it's a user install, but there's nothing preventing you from installing it to /opt or whatever and adding some symlinks to /bin. I find it being user-only to be extremely useful; users don't need sudo (other than libs). Disk space is cheap.
        – Nick T
        Jun 25 '17 at 15:30














      • 1




        There's one caveat, when using pyenv with Python 2.x (or very old 3.x releases before the new Unicode string internal representation happened): pyenv uses the default upstream compilation flags and builds with 16-bit Unicode strings. Linux distros generally build with 32-bit Unicode strings. This causes pain when you pip install some stuff into both pyenv and non-pyenv Pythons, because the of pip wheel caching.
        – Marius Gedminas
        Jan 10 '17 at 8:34










      • @marius why would you ever use a non-pyenv version after installing it?
        – Nick T
        Jan 10 '17 at 14:34






      • 3




        I don't know, but I discovered this issue by helping someone on IRC debug a problem where a particular Python package (lxml?) failed to work due to this. So it happens in practice, to some people, and is worth knowing. (The workaround is rm -r ~/.cache/pip/wheels/.)
        – Marius Gedminas
        Jan 11 '17 at 6:30






      • 1




        Does pyenv need to be installed for every user which need Python? And if I have 3 users who need same Python 3.6 version, then it'll have to compile it 3 times and it will take 3x disk space? If that's true then it sucks… :/
        – Sarge Borsch
        Jun 25 '17 at 11:54






      • 1




        @SargeBorsch by default (if you use pyenv-installer) it's a user install, but there's nothing preventing you from installing it to /opt or whatever and adding some symlinks to /bin. I find it being user-only to be extremely useful; users don't need sudo (other than libs). Disk space is cheap.
        – Nick T
        Jun 25 '17 at 15:30








      1




      1




      There's one caveat, when using pyenv with Python 2.x (or very old 3.x releases before the new Unicode string internal representation happened): pyenv uses the default upstream compilation flags and builds with 16-bit Unicode strings. Linux distros generally build with 32-bit Unicode strings. This causes pain when you pip install some stuff into both pyenv and non-pyenv Pythons, because the of pip wheel caching.
      – Marius Gedminas
      Jan 10 '17 at 8:34




      There's one caveat, when using pyenv with Python 2.x (or very old 3.x releases before the new Unicode string internal representation happened): pyenv uses the default upstream compilation flags and builds with 16-bit Unicode strings. Linux distros generally build with 32-bit Unicode strings. This causes pain when you pip install some stuff into both pyenv and non-pyenv Pythons, because the of pip wheel caching.
      – Marius Gedminas
      Jan 10 '17 at 8:34












      @marius why would you ever use a non-pyenv version after installing it?
      – Nick T
      Jan 10 '17 at 14:34




      @marius why would you ever use a non-pyenv version after installing it?
      – Nick T
      Jan 10 '17 at 14:34




      3




      3




      I don't know, but I discovered this issue by helping someone on IRC debug a problem where a particular Python package (lxml?) failed to work due to this. So it happens in practice, to some people, and is worth knowing. (The workaround is rm -r ~/.cache/pip/wheels/.)
      – Marius Gedminas
      Jan 11 '17 at 6:30




      I don't know, but I discovered this issue by helping someone on IRC debug a problem where a particular Python package (lxml?) failed to work due to this. So it happens in practice, to some people, and is worth knowing. (The workaround is rm -r ~/.cache/pip/wheels/.)
      – Marius Gedminas
      Jan 11 '17 at 6:30




      1




      1




      Does pyenv need to be installed for every user which need Python? And if I have 3 users who need same Python 3.6 version, then it'll have to compile it 3 times and it will take 3x disk space? If that's true then it sucks… :/
      – Sarge Borsch
      Jun 25 '17 at 11:54




      Does pyenv need to be installed for every user which need Python? And if I have 3 users who need same Python 3.6 version, then it'll have to compile it 3 times and it will take 3x disk space? If that's true then it sucks… :/
      – Sarge Borsch
      Jun 25 '17 at 11:54




      1




      1




      @SargeBorsch by default (if you use pyenv-installer) it's a user install, but there's nothing preventing you from installing it to /opt or whatever and adding some symlinks to /bin. I find it being user-only to be extremely useful; users don't need sudo (other than libs). Disk space is cheap.
      – Nick T
      Jun 25 '17 at 15:30




      @SargeBorsch by default (if you use pyenv-installer) it's a user install, but there's nothing preventing you from installing it to /opt or whatever and adding some symlinks to /bin. I find it being user-only to be extremely useful; users don't need sudo (other than libs). Disk space is cheap.
      – Nick T
      Jun 25 '17 at 15:30










      up vote
      13
      down vote













      An alternative route if you can't find any working repos would be you could try compiling yourself from source. You can find the source code on the download page. Then download and untar the tarball; for example for Python-3.6.1.tgz.



      The process for untarring the tgz file is:



      tar -xvzf /path/to/yourfile.tgz


      Once you are in the file path the file was unzipped to, run:



      ./configure
      make
      make altinstall


      And hopefully this should solve the problem for you.






      share|improve this answer



















      • 4




        Question says (id preferably not build it on my own). Maybe it'd be better to go the apt route if possible.
        – TheWanderer
        Dec 28 '16 at 20:11










      • Ok, I'll have a look see if I can find any alternative repositories for you. Did you get a chance to look on Google for alternative repos yourself yet? I don't want to suggest things you've already tried.
        – Just In Time Berlake
        Dec 28 '16 at 20:13










      • I'm not the OP. Just making a suggestion. I couldn't find any PPAs for 3.6, so building might be the necessary route. You should probably address that in your answer though.
        – TheWanderer
        Dec 28 '16 at 20:14










      • Your make commands will fail on a system that the user has never built anything, as there are many packages required. "sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev"
        – Joe
        Apr 27 at 15:43

















      up vote
      13
      down vote













      An alternative route if you can't find any working repos would be you could try compiling yourself from source. You can find the source code on the download page. Then download and untar the tarball; for example for Python-3.6.1.tgz.



      The process for untarring the tgz file is:



      tar -xvzf /path/to/yourfile.tgz


      Once you are in the file path the file was unzipped to, run:



      ./configure
      make
      make altinstall


      And hopefully this should solve the problem for you.






      share|improve this answer



















      • 4




        Question says (id preferably not build it on my own). Maybe it'd be better to go the apt route if possible.
        – TheWanderer
        Dec 28 '16 at 20:11










      • Ok, I'll have a look see if I can find any alternative repositories for you. Did you get a chance to look on Google for alternative repos yourself yet? I don't want to suggest things you've already tried.
        – Just In Time Berlake
        Dec 28 '16 at 20:13










      • I'm not the OP. Just making a suggestion. I couldn't find any PPAs for 3.6, so building might be the necessary route. You should probably address that in your answer though.
        – TheWanderer
        Dec 28 '16 at 20:14










      • Your make commands will fail on a system that the user has never built anything, as there are many packages required. "sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev"
        – Joe
        Apr 27 at 15:43















      up vote
      13
      down vote










      up vote
      13
      down vote









      An alternative route if you can't find any working repos would be you could try compiling yourself from source. You can find the source code on the download page. Then download and untar the tarball; for example for Python-3.6.1.tgz.



      The process for untarring the tgz file is:



      tar -xvzf /path/to/yourfile.tgz


      Once you are in the file path the file was unzipped to, run:



      ./configure
      make
      make altinstall


      And hopefully this should solve the problem for you.






      share|improve this answer














      An alternative route if you can't find any working repos would be you could try compiling yourself from source. You can find the source code on the download page. Then download and untar the tarball; for example for Python-3.6.1.tgz.



      The process for untarring the tgz file is:



      tar -xvzf /path/to/yourfile.tgz


      Once you are in the file path the file was unzipped to, run:



      ./configure
      make
      make altinstall


      And hopefully this should solve the problem for you.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 20 '17 at 5:23









      David Foerster

      27.6k1363108




      27.6k1363108










      answered Dec 28 '16 at 20:10









      Just In Time Berlake

      355312




      355312








      • 4




        Question says (id preferably not build it on my own). Maybe it'd be better to go the apt route if possible.
        – TheWanderer
        Dec 28 '16 at 20:11










      • Ok, I'll have a look see if I can find any alternative repositories for you. Did you get a chance to look on Google for alternative repos yourself yet? I don't want to suggest things you've already tried.
        – Just In Time Berlake
        Dec 28 '16 at 20:13










      • I'm not the OP. Just making a suggestion. I couldn't find any PPAs for 3.6, so building might be the necessary route. You should probably address that in your answer though.
        – TheWanderer
        Dec 28 '16 at 20:14










      • Your make commands will fail on a system that the user has never built anything, as there are many packages required. "sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev"
        – Joe
        Apr 27 at 15:43
















      • 4




        Question says (id preferably not build it on my own). Maybe it'd be better to go the apt route if possible.
        – TheWanderer
        Dec 28 '16 at 20:11










      • Ok, I'll have a look see if I can find any alternative repositories for you. Did you get a chance to look on Google for alternative repos yourself yet? I don't want to suggest things you've already tried.
        – Just In Time Berlake
        Dec 28 '16 at 20:13










      • I'm not the OP. Just making a suggestion. I couldn't find any PPAs for 3.6, so building might be the necessary route. You should probably address that in your answer though.
        – TheWanderer
        Dec 28 '16 at 20:14










      • Your make commands will fail on a system that the user has never built anything, as there are many packages required. "sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev"
        – Joe
        Apr 27 at 15:43










      4




      4




      Question says (id preferably not build it on my own). Maybe it'd be better to go the apt route if possible.
      – TheWanderer
      Dec 28 '16 at 20:11




      Question says (id preferably not build it on my own). Maybe it'd be better to go the apt route if possible.
      – TheWanderer
      Dec 28 '16 at 20:11












      Ok, I'll have a look see if I can find any alternative repositories for you. Did you get a chance to look on Google for alternative repos yourself yet? I don't want to suggest things you've already tried.
      – Just In Time Berlake
      Dec 28 '16 at 20:13




      Ok, I'll have a look see if I can find any alternative repositories for you. Did you get a chance to look on Google for alternative repos yourself yet? I don't want to suggest things you've already tried.
      – Just In Time Berlake
      Dec 28 '16 at 20:13












      I'm not the OP. Just making a suggestion. I couldn't find any PPAs for 3.6, so building might be the necessary route. You should probably address that in your answer though.
      – TheWanderer
      Dec 28 '16 at 20:14




      I'm not the OP. Just making a suggestion. I couldn't find any PPAs for 3.6, so building might be the necessary route. You should probably address that in your answer though.
      – TheWanderer
      Dec 28 '16 at 20:14












      Your make commands will fail on a system that the user has never built anything, as there are many packages required. "sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev"
      – Joe
      Apr 27 at 15:43






      Your make commands will fail on a system that the user has never built anything, as there are many packages required. "sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev"
      – Joe
      Apr 27 at 15:43












      up vote
      9
      down vote













      It depends on which version of Ubuntu you are using.



      Ubuntu 16.10 and Ubuntu 17.04



      Since Python 3.6 is installed in the universe repository of Ubuntu 16.10 and Ubuntu 17.04, you can directly install python 3.6 from the repository. Just use the commands below:



      sudo apt update
      sudo apt install python3.6


      Ubuntu 16.04



      There are two ways to install Python3.6 on Ubuntu 16.04




      • Compile and install python 3.6 on Ubuntu 16.04

      • Install python 3.6 on Ubuntu 16.04 from PPA


      1. Compile and install python 3.6 on Ubuntu 16.04



      Install the necessary dependencies, download the python 3.6 source code, and build the environment and install



      sudo apt install build-essential checkinstall
      sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
      wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
      tar xvf Python-3.6.0.tar.xz
      cd Python-3.6.0/
      ./configure
      sudo make altinstall


      2. Install python 3.6 on Ubuntu 16.04 from PPA



      You can install Python 3.6  from PPA using the commands below



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt update
      sudo apt install python3.6


      If Python 3.6 is correctly installed, you can invoke the python interpreter by running python3.6 in the terminal.



      I hope this helps. If you are having any issues, you can check this blog post here.






      share|improve this answer

















      • 2




        This is essentially a copy of the accepted answer. Where is the added valuee of your answer?
        – Marc Vanhoomissen
        Jan 4 at 19:28






      • 2




        The first step in the Ubuntu 16.04 is for those who want to compile and install python 3.6 for some reason. The process of compile and install Python 3.6 on Ubuntu 16.04 isn't available in the accepted answer or any answer in the thread for that matter. The other points are to make clear the version of Ubuntu and how it differs from other accepted answers.
        – Aryal Bibek
        Jan 5 at 6:01










      • PPA installs on 16.04 (Mint) appear broken. The installation from source info is useful.
        – demented hedgehog
        May 7 at 22:46















      up vote
      9
      down vote













      It depends on which version of Ubuntu you are using.



      Ubuntu 16.10 and Ubuntu 17.04



      Since Python 3.6 is installed in the universe repository of Ubuntu 16.10 and Ubuntu 17.04, you can directly install python 3.6 from the repository. Just use the commands below:



      sudo apt update
      sudo apt install python3.6


      Ubuntu 16.04



      There are two ways to install Python3.6 on Ubuntu 16.04




      • Compile and install python 3.6 on Ubuntu 16.04

      • Install python 3.6 on Ubuntu 16.04 from PPA


      1. Compile and install python 3.6 on Ubuntu 16.04



      Install the necessary dependencies, download the python 3.6 source code, and build the environment and install



      sudo apt install build-essential checkinstall
      sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
      wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
      tar xvf Python-3.6.0.tar.xz
      cd Python-3.6.0/
      ./configure
      sudo make altinstall


      2. Install python 3.6 on Ubuntu 16.04 from PPA



      You can install Python 3.6  from PPA using the commands below



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt update
      sudo apt install python3.6


      If Python 3.6 is correctly installed, you can invoke the python interpreter by running python3.6 in the terminal.



      I hope this helps. If you are having any issues, you can check this blog post here.






      share|improve this answer

















      • 2




        This is essentially a copy of the accepted answer. Where is the added valuee of your answer?
        – Marc Vanhoomissen
        Jan 4 at 19:28






      • 2




        The first step in the Ubuntu 16.04 is for those who want to compile and install python 3.6 for some reason. The process of compile and install Python 3.6 on Ubuntu 16.04 isn't available in the accepted answer or any answer in the thread for that matter. The other points are to make clear the version of Ubuntu and how it differs from other accepted answers.
        – Aryal Bibek
        Jan 5 at 6:01










      • PPA installs on 16.04 (Mint) appear broken. The installation from source info is useful.
        – demented hedgehog
        May 7 at 22:46













      up vote
      9
      down vote










      up vote
      9
      down vote









      It depends on which version of Ubuntu you are using.



      Ubuntu 16.10 and Ubuntu 17.04



      Since Python 3.6 is installed in the universe repository of Ubuntu 16.10 and Ubuntu 17.04, you can directly install python 3.6 from the repository. Just use the commands below:



      sudo apt update
      sudo apt install python3.6


      Ubuntu 16.04



      There are two ways to install Python3.6 on Ubuntu 16.04




      • Compile and install python 3.6 on Ubuntu 16.04

      • Install python 3.6 on Ubuntu 16.04 from PPA


      1. Compile and install python 3.6 on Ubuntu 16.04



      Install the necessary dependencies, download the python 3.6 source code, and build the environment and install



      sudo apt install build-essential checkinstall
      sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
      wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
      tar xvf Python-3.6.0.tar.xz
      cd Python-3.6.0/
      ./configure
      sudo make altinstall


      2. Install python 3.6 on Ubuntu 16.04 from PPA



      You can install Python 3.6  from PPA using the commands below



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt update
      sudo apt install python3.6


      If Python 3.6 is correctly installed, you can invoke the python interpreter by running python3.6 in the terminal.



      I hope this helps. If you are having any issues, you can check this blog post here.






      share|improve this answer












      It depends on which version of Ubuntu you are using.



      Ubuntu 16.10 and Ubuntu 17.04



      Since Python 3.6 is installed in the universe repository of Ubuntu 16.10 and Ubuntu 17.04, you can directly install python 3.6 from the repository. Just use the commands below:



      sudo apt update
      sudo apt install python3.6


      Ubuntu 16.04



      There are two ways to install Python3.6 on Ubuntu 16.04




      • Compile and install python 3.6 on Ubuntu 16.04

      • Install python 3.6 on Ubuntu 16.04 from PPA


      1. Compile and install python 3.6 on Ubuntu 16.04



      Install the necessary dependencies, download the python 3.6 source code, and build the environment and install



      sudo apt install build-essential checkinstall
      sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
      wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
      tar xvf Python-3.6.0.tar.xz
      cd Python-3.6.0/
      ./configure
      sudo make altinstall


      2. Install python 3.6 on Ubuntu 16.04 from PPA



      You can install Python 3.6  from PPA using the commands below



      sudo add-apt-repository ppa:jonathonf/python-3.6
      sudo apt update
      sudo apt install python3.6


      If Python 3.6 is correctly installed, you can invoke the python interpreter by running python3.6 in the terminal.



      I hope this helps. If you are having any issues, you can check this blog post here.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jan 4 at 18:51









      Aryal Bibek

      9113




      9113








      • 2




        This is essentially a copy of the accepted answer. Where is the added valuee of your answer?
        – Marc Vanhoomissen
        Jan 4 at 19:28






      • 2




        The first step in the Ubuntu 16.04 is for those who want to compile and install python 3.6 for some reason. The process of compile and install Python 3.6 on Ubuntu 16.04 isn't available in the accepted answer or any answer in the thread for that matter. The other points are to make clear the version of Ubuntu and how it differs from other accepted answers.
        – Aryal Bibek
        Jan 5 at 6:01










      • PPA installs on 16.04 (Mint) appear broken. The installation from source info is useful.
        – demented hedgehog
        May 7 at 22:46














      • 2




        This is essentially a copy of the accepted answer. Where is the added valuee of your answer?
        – Marc Vanhoomissen
        Jan 4 at 19:28






      • 2




        The first step in the Ubuntu 16.04 is for those who want to compile and install python 3.6 for some reason. The process of compile and install Python 3.6 on Ubuntu 16.04 isn't available in the accepted answer or any answer in the thread for that matter. The other points are to make clear the version of Ubuntu and how it differs from other accepted answers.
        – Aryal Bibek
        Jan 5 at 6:01










      • PPA installs on 16.04 (Mint) appear broken. The installation from source info is useful.
        – demented hedgehog
        May 7 at 22:46








      2




      2




      This is essentially a copy of the accepted answer. Where is the added valuee of your answer?
      – Marc Vanhoomissen
      Jan 4 at 19:28




      This is essentially a copy of the accepted answer. Where is the added valuee of your answer?
      – Marc Vanhoomissen
      Jan 4 at 19:28




      2




      2




      The first step in the Ubuntu 16.04 is for those who want to compile and install python 3.6 for some reason. The process of compile and install Python 3.6 on Ubuntu 16.04 isn't available in the accepted answer or any answer in the thread for that matter. The other points are to make clear the version of Ubuntu and how it differs from other accepted answers.
      – Aryal Bibek
      Jan 5 at 6:01




      The first step in the Ubuntu 16.04 is for those who want to compile and install python 3.6 for some reason. The process of compile and install Python 3.6 on Ubuntu 16.04 isn't available in the accepted answer or any answer in the thread for that matter. The other points are to make clear the version of Ubuntu and how it differs from other accepted answers.
      – Aryal Bibek
      Jan 5 at 6:01












      PPA installs on 16.04 (Mint) appear broken. The installation from source info is useful.
      – demented hedgehog
      May 7 at 22:46




      PPA installs on 16.04 (Mint) appear broken. The installation from source info is useful.
      – demented hedgehog
      May 7 at 22:46










      up vote
      4
      down vote













      For Ubuntu 15.10 I installed it successfully using this method:



      sudo add-apt-repository ppa:jonathonf/python-3.6


      But I edited this file:



      sudo vi /etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-wily.list


      And I changed wily to trusty and then:



      sudo apt-get update
      sudo apt-get install python3.6





      share|improve this answer



















      • 11




        Ubuntu 15.10? It has gone EOL months ago. Time to upgrade.
        – edwinksl
        Jun 14 '17 at 7:19















      up vote
      4
      down vote













      For Ubuntu 15.10 I installed it successfully using this method:



      sudo add-apt-repository ppa:jonathonf/python-3.6


      But I edited this file:



      sudo vi /etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-wily.list


      And I changed wily to trusty and then:



      sudo apt-get update
      sudo apt-get install python3.6





      share|improve this answer



















      • 11




        Ubuntu 15.10? It has gone EOL months ago. Time to upgrade.
        – edwinksl
        Jun 14 '17 at 7:19













      up vote
      4
      down vote










      up vote
      4
      down vote









      For Ubuntu 15.10 I installed it successfully using this method:



      sudo add-apt-repository ppa:jonathonf/python-3.6


      But I edited this file:



      sudo vi /etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-wily.list


      And I changed wily to trusty and then:



      sudo apt-get update
      sudo apt-get install python3.6





      share|improve this answer














      For Ubuntu 15.10 I installed it successfully using this method:



      sudo add-apt-repository ppa:jonathonf/python-3.6


      But I edited this file:



      sudo vi /etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-wily.list


      And I changed wily to trusty and then:



      sudo apt-get update
      sudo apt-get install python3.6






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 14 '17 at 7:11

























      answered Jun 14 '17 at 6:59









      hassan ketabi

      1512




      1512








      • 11




        Ubuntu 15.10? It has gone EOL months ago. Time to upgrade.
        – edwinksl
        Jun 14 '17 at 7:19














      • 11




        Ubuntu 15.10? It has gone EOL months ago. Time to upgrade.
        – edwinksl
        Jun 14 '17 at 7:19








      11




      11




      Ubuntu 15.10? It has gone EOL months ago. Time to upgrade.
      – edwinksl
      Jun 14 '17 at 7:19




      Ubuntu 15.10? It has gone EOL months ago. Time to upgrade.
      – edwinksl
      Jun 14 '17 at 7:19










      up vote
      2
      down vote













      Consider pyenv + pipenv which is to replace using PIP + virtual environments using Pipfile



      Then in Pipfile



      [requires]
      python_version = "3.6"


      https://stackoverflow.com/a/49800061/1689770






      share|improve this answer

























        up vote
        2
        down vote













        Consider pyenv + pipenv which is to replace using PIP + virtual environments using Pipfile



        Then in Pipfile



        [requires]
        python_version = "3.6"


        https://stackoverflow.com/a/49800061/1689770






        share|improve this answer























          up vote
          2
          down vote










          up vote
          2
          down vote









          Consider pyenv + pipenv which is to replace using PIP + virtual environments using Pipfile



          Then in Pipfile



          [requires]
          python_version = "3.6"


          https://stackoverflow.com/a/49800061/1689770






          share|improve this answer












          Consider pyenv + pipenv which is to replace using PIP + virtual environments using Pipfile



          Then in Pipfile



          [requires]
          python_version = "3.6"


          https://stackoverflow.com/a/49800061/1689770







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 2 at 2:40









          Jonathan

          1,22521327




          1,22521327






















              up vote
              0
              down vote













              First, follow some of the other answers to install Python 3.6 or 3.7. Then, if want to install PyPi packages such as OpenEXR through pip you may get some errors. Some of them (e.g. for OpenEXR's PyPi package) might get resolved by installing Python development package for your newly-installed Python. This can be done using the followings:



              sudo apt-get install python3.6-dev



              or



              sudo apt-get install python3.7-dev






              share|improve this answer



























                up vote
                0
                down vote













                First, follow some of the other answers to install Python 3.6 or 3.7. Then, if want to install PyPi packages such as OpenEXR through pip you may get some errors. Some of them (e.g. for OpenEXR's PyPi package) might get resolved by installing Python development package for your newly-installed Python. This can be done using the followings:



                sudo apt-get install python3.6-dev



                or



                sudo apt-get install python3.7-dev






                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  First, follow some of the other answers to install Python 3.6 or 3.7. Then, if want to install PyPi packages such as OpenEXR through pip you may get some errors. Some of them (e.g. for OpenEXR's PyPi package) might get resolved by installing Python development package for your newly-installed Python. This can be done using the followings:



                  sudo apt-get install python3.6-dev



                  or



                  sudo apt-get install python3.7-dev






                  share|improve this answer














                  First, follow some of the other answers to install Python 3.6 or 3.7. Then, if want to install PyPi packages such as OpenEXR through pip you may get some errors. Some of them (e.g. for OpenEXR's PyPi package) might get resolved by installing Python development package for your newly-installed Python. This can be done using the followings:



                  sudo apt-get install python3.6-dev



                  or



                  sudo apt-get install python3.7-dev







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 24 at 18:38

























                  answered Oct 21 at 3:19









                  Amir

                  2521313




                  2521313

















                      protected by Community Mar 13 at 13:11



                      Thank you for your interest in this question.
                      Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                      Would you like to answer one of these unanswered questions instead?



                      Popular posts from this blog

                      Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                      ComboBox Display Member on multiple fields

                      Is it possible to collect Nectar points via Trainline?