Installation of a Python Version in your own User Directory

 

From the website of python.org you can download the desired Python version for your own platform. As an example I take the compressed archive Python-3.7.0.tar.xz for Linux. In this archive there is the file README.rst, which has to be read first in any case! The information on the page is also useful. Especially the chapter Python Setup and Usage . Here you can find installation instructions for the different operating systems (Linux, Windows, Macintosh). Unpack the archive in a installation folder and install/translate manually (in LINUX) in a console in your installation folder with the usual command sequence ./configure –prefix=target directory  –enable-optimizations, make and sudo make altinstall.  As target directory, enter the full path for the directory where you want to install Python. My target directory is /home/lothar/Python-3.7.2. After the installation you can delete the installations folder. But be careful, to get all the functionality of Python 3.7, you need a set of developer libraries that must already be present on the PC. For Ubuntu 16.04 the whole installation process is fully described on a webpage. Please pay attention carefully!

So that the personal Python version with the command python3.X is also found in a console, the following entry should be made in the file .profile in the home directory of the user, preferably at the end:

PATH=$PATH:$HOME/Python-3.7.2/bin

Save the changed file, log out as user and log in again (then the file .profile is read in again). Then the call of Python should work in a console with python3.X (replace X with the version number, e.g. python3.7). The successful start of Python is recognizable in the console by the expression like this one:

lothar@tux:~$ python3.7

Python 3.7.0 (default, Aug 13 2018, 17:47:14)

[GCC 5.4.0 20160609] on linux

Type „help“, „copyright“, „credits“ or „license“ for more information.

>>>

After the new prompt >>> you can now enter the Python commands for interactive working. You leave Python by typing quit().

If all these tips have been considered, you will have all the source codes compiled within a few minutes to a few hours, which takes very different lengths depending on the speed of your own PC/laptop. A user-specific Python basic version is installed, which does not affect or interfere with the version of the operating system and which can be changed, updated and supplemented at any time. In the same way, you can install several different Python versions in parallel in different directories in your own user directory, including the Anaconda distribution.

The Python installed in this way contains only the basic version of the installed release. For scientific work, especially for working with numerical data like spectra, we need a number of additional modules.