Most of the current Unix-based operating systems (Linux, FreeBSD and OSX) use Python for running some of their “daily tasks”, which means that a Python interpreter is already available. However, usually it is better to use our own interpreter because:
In Windows you need to install Python, yes or yes, from the official website. However, notice that this “guide” only contemplates the installation of Python in Unix-based OS machines, and specifically, in a Xubuntu computer.
As said before, it is very likely that your Unix-like OS has Python installed. However, in order to control the version of the Python interpreter, we will install a dedicated one.
Go to YAPT/01-hello_world/02-installation.ipynb [1] and follow the instructions to install the lastest stable version CPython, and create a new virtual environment called tm with pyenv. Basically (example for Python 3.9.7):
Install package dependencies for compiling Python:
Download Pyenv:
(Optional) Compile a dynamic Bash extension to speed up Pyenv.
Define the PYENV_ROOT environment variable to point to the path where you cloned the Pyenv repo. For this, put these lines into ~/.profile1 before the part that sources ~/.bashrc2.
Run:
to put these lines at the bottom of ~/.bashrc to enable autocompletion and all subcommands.
List the available Python interpreters:
Install the Python interpreter (and some basic tools such as pip):
Check what it is currently available:
You should get something such as:
Select the Python interperter:
Install an IDE for programming with Python. I recommend Thonny if you are not used to any other.
[1] V. González Ruiz. YAPT.
1This configuration file is sourced by the bash interperter only when a login shell is done (when the system requests your identity and you are able to privide it.
2This configuration file is sourced by the bash interpreter when you request a non-login shell, i.e., when you reinstance the interpreter, for example, running a new terminal.