
{"id":8670,"date":"2019-02-22T15:47:36","date_gmt":"2019-02-22T15:47:36","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=8670"},"modified":"2019-10-12T14:59:48","modified_gmt":"2019-10-12T14:59:48","slug":"install-python-3-7-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2019\/02\/install-python-3-7-ubuntu-18-04\/","title":{"rendered":"How to Install Python 3.7.2 in Ubuntu 18.04 \/ 18.10"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2017\/07\/python-icon245.png\" alt=\"\" width=\"245\" height=\"250\" class=\"aligncenter size-full wp-image-6928\" \/><\/p>\n<p>This quick tutorial is for those who want to install the latest Python 3.7.2 in Ubuntu 18.04 LTS, Linux Mint 19.x, and Ubuntu 18.10.<\/p>\n<p>Ubuntu 18.04 comes with Python 2.7 and Python 3.6 out-of-the-box, and later includes Python 3.7.1 in its updates (universe) repository.<\/p>\n<p>For the updated Python 3.7.2, you can do following steps to use the <a href=\"https:\/\/wiki.ubuntu.com\/ToolChain\" rel=\"noopener\" target=\"_blank\">ToolChain<\/a> PPA packages.<\/p>\n<p><b>1.<\/b> Open terminal either via <b>Ctrl+Alt+T<\/b> keyboard shortcut or by searching for \u201cTerminal\u201d from app launcher. When it opens, run command to add the <a href=\"https:\/\/launchpad.net\/~ubuntu-toolchain-r\/+archive\/ppa\" rel=\"noopener\" target=\"_blank\">ToolChain PPA<\/a>:<\/p>\n<pre style=\"border:none;\">sudo add-apt-repository ppa:ubuntu-toolchain-r\/ppa<\/pre>\n<p><i>Type user password (no visual feedback) when it asks and hit Enter to continue.<\/i><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/toolchain-ppa-600x102.jpg\" alt=\"\" width=\"600\" height=\"102\" class=\"aligncenter size-large wp-image-8671\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/toolchain-ppa-600x102.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/toolchain-ppa-450x76.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/toolchain-ppa.jpg 750w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>2.<\/b> Then run command to install Python3.7:<\/p>\n<pre style=\"border:none;\">sudo apt install python3.7<\/pre>\n<p><i>For Linux Mint 19.x, run command <code>sudo apt update<\/code> to check updates first.<\/i><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/install-python37-600x297.jpg\" alt=\"\" width=\"600\" height=\"297\" class=\"aligncenter size-large wp-image-8672\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/install-python37-600x297.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/install-python37-450x223.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/install-python37.jpg 759w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>3.<\/b> As the PPA contains other updates toolchain packages, e.g., gcc-7.4.0, gcc-8.2.0, and python-3.6.8, you may remove the PPA afterwards via <b>Software &#038; Updates -> Other Software<\/b> tab.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/remove-toolchain-ppa.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/remove-toolchain-ppa-450x301.jpg\" alt=\"\" width=\"450\" height=\"301\" class=\"aligncenter size-medium wp-image-8673\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/remove-toolchain-ppa-450x301.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/remove-toolchain-ppa-600x401.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/remove-toolchain-ppa.jpg 733w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p><b>4.<\/b> To make <code>python3<\/code> use the new installed python 3.7.2 instead of the default 3.6.7, run commands to add python3.7 as choice:<\/p>\n<div class=\"arconix-box arconix-box-yellow\"><i class='fa fa-2x pull-left fa-lightbulb-o'><\/i><div class=\"arconix-box-content\">This step may cause issues that depends python3.6! As I know, terminal won&#8217;t launch afterwards unless you recreate a symlink to python3.6.<\/p>\n<p>For Ubuntu 18.04, you may run following 2 commands as a workaround:<\/p>\n<pre style=\"border:none\">sudo rm \/usr\/bin\/python3\r\n\r\nsudo ln -s python3.6 \/usr\/bin\/python3<\/pre>\n<\/div><\/div>\n<pre style=\"border:none;\">sudo update-alternatives --install \/usr\/bin\/python3 python3 \/usr\/bin\/python3.6 1\r\n\r\nsudo update-alternatives --install \/usr\/bin\/python3 python3 \/usr\/bin\/python3.7 2<\/pre>\n<p>Then switch between the two versions via command:<\/p>\n<pre style=\"border:none;\">sudo update-alternatives --config python3<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/python3.7-default-600x254.jpg\" alt=\"\" width=\"600\" height=\"254\" class=\"aligncenter size-large wp-image-8674\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/python3.7-default-600x254.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/python3.7-default-450x191.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2019\/02\/python3.7-default.jpg 753w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>That&#8217;s it. Enjoy!<\/p>","protected":false},"excerpt":{"rendered":"<p>This quick tutorial is for those who want to install the latest Python 3.7.2 in Ubuntu 18.04 LTS, Linux Mint 19.x, and Ubuntu 18.10. Ubuntu 18.04 comes with Python 2.7 and Python 3.6 out-of-the-box, and later includes Python 3.7.1 in its updates (universe) repository. For the updated Python 3.7.2, you can do following steps to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1652],"class_list":["post-8670","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-python-3-7"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/8670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=8670"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/8670\/revisions"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=8670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=8670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=8670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}