{"id":19,"date":"2022-04-15T06:06:50","date_gmt":"2022-04-15T06:06:50","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/mogblog\/?p=19"},"modified":"2022-04-15T06:06:50","modified_gmt":"2022-04-15T06:06:50","slug":"updating-python","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/mogblog\/2022\/04\/15\/updating-python\/","title":{"rendered":"Updating Python&#8230;"},"content":{"rendered":"\n<p>I recently had to update the python version on an embedded device running Python 3.6. This process seems like it should be straightforward. I should <code>sudo-apt install python3.9<\/code> and an update should be installed. This, however, wasn&#8217;t the case for me.<\/p>\n\n\n\n<p>My installation process was a winding path wherein the majority of the knowledge was acquired from a blog that is unassociated with python.org. A search of the site yields no results regarding updating on Linux.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-1024x782.png\" alt=\"\" class=\"wp-image-20\" width=\"653\" height=\"498\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-1024x782.png 1024w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-300x229.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-768x586.png 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled.png 1132w\" sizes=\"auto, (max-width: 653px) 100vw, 653px\" \/><figcaption>Screenshot of the English Forums<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"949\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-1-1024x949.png\" alt=\"\" class=\"wp-image-21\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-1-1024x949.png 1024w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-1-300x278.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-1-768x712.png 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5468\/files\/2022\/04\/Untitled-1.png 1209w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Screenshot of the Python webs<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">The actual updating process<\/h2>\n\n\n\n<p>What I had to do:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# Upgrade Python\n$ sudo apt update\n$ sudo apt install software-properties-common\n$ sudo add-apt-repository ppa:deadsnakes\/ppa\n$ sudo apt install python 3.9\n$ python3.9 --version # verify the python installation\n<\/pre><\/div>\n\n\n<p>At this point it seems like you should be done. Python should work and it should be the most recent version but no&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Upgrade pip\n$ python -m pip install --upgrade pip<\/code><\/pre>\n\n\n\n<p>Are we done? Not quite<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# Set python version\n$ sudo update-alternatives --install \/usr\/bin\/python python \/usr\/bin\/python3.6 1\n$ sudo update-alternatives --install \/usr\/bin\/python python \/usr\/bin\/python3.9 2\n$ sudo update-alternatives --install \/usr\/bin\/python python \/usr\/bin\/python2.7 3\n$ sudo update-alternatives --config python\n<\/pre><\/div>\n\n\n<p>Finally! We can (hopefully) now run <code>python -v<\/code> and have an expected result. This process is a cobbled together verion of various stackoverflow and blog posts. What should have taken 15 minutes ended up taking an hour and a half. This points to poor documentation. In a perfect world python.org would provide this info. Hopefully we get there soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently had to update the python version on an embedded device running Python 3.6. This process seems like it should be straightforward. I should sudo-apt install python3.9 and an update should be installed. This, however, wasn&#8217;t the case for me. My installation process was a winding path wherein the majority of the knowledge was [&hellip;]<\/p>\n","protected":false},"author":12320,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,8,7,9,1],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-devops","category-linux","category-python","category-ubuntu","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/users\/12320"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":2,"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":25,"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/posts\/19\/revisions\/25"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mogblog\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}