Open main menu

Changes

844 bytes added ,  07:40, 7 October 2020
Add info about using update-alternatives
== Check Python ==
Check the version of the default Python interpreter:
<code>python --version</code>
 
List the versions of python available:
<code>ls /usr/bin/python*</code>
 
Use <code>update-alternatives</code> to setup system-wide ability to choose Python interpreter. The one with the '''higher''' priority number will become the default.<br>
<code>update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1</code><br>
<code>update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2</code>
 
Now we can list the choices:
<code>update-alternatives --list python</code>
 
And choose one:
<code>update-alternatives --config python</code>
 
We can also remove a choice if it's no longer an option on the system:
<code>update-alternatives --remove python /usr/bin/python2.7</code>
 
== Python Virtual Environments ==
See Digital Ocean's quick guide to [https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04 setting up a local Python programming environment], including [https://virtualenv.pypa.io/en/stable/ virtual environments], which is what I did for [https://github.com/Miserlou/SoundScrape SoundScrape] Btw, SoundScrape is a neat tool to download sound files from SoundCloud.
<ref>