Installation de Python

  • First choose a python version available here.

For example, to download Python 3.9.5 copy the link on the page :

$ wget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz
  • Then, choose your install directory by setting this variable path, for example :
$ export PYTHON_INSTALL_DIR=$WORKDIR/opt/python/3.9.5
  • Then compile and install it :
$ tar xvf Python-3.9.5.tgz
$ cd Python-3.9.5
$ ./configure --prefix=$PYTHON_INSTALL_DIR
$ make -j4
$ make install
  • Finally, add these in your .bashrc :
export PATH=$WORKDIR/opt/python/3.9.5/bin:$PATH
alias python='python3'