Skip to main content

Python

Let's install Python! Python is a very easy-to-learn language, that we used to serve the website.

The Python language

For Nantral Platform, we need to install the Python 3.10 version. Be sure to select the correct version!! ⚠️

Download and install Python from the Windows Store.

info

You can also download Python from the official website. In this case, be careful to check the "Add python to the PATH" option during the installation.

After the installation, check that it works properly:

  • Open a new terminal
  • Type this command and press ENTER to run it:
    python3 --version
  • You should see the Python version on a new line: Python 3.xx
The command does not work or the version is not python3.10, what can I do? 😭

Sometimes you can have multiple versions of python installed on your system: in this case, using python can refer to another version of python (for instance, it refers by default to python2 if it is installed).

To avoid this, you can precise which version you want to use by adding the version to the command: try to run python instead of python3, to get the correct version, or python3.7 for example.

Also notice that on Windows, python is sometimes replaced by py only: in this case, you can precise the version by runnning py -3 for example.

Once you have found the command that works for you, memorize it: in the following, we will always use python or python3 but you might need to replace it by the command which works for you.

If the command is still not recognized, try to close and reopen your terminal, or try to reboot your computer to refresh the available commands.

Package installer for Python (pip)

Pip should have been installed with Python. To verify this, run:

python3 -m pip --version

It should produce a line like this: pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

I have the error "command pip not found", what can I do?

First, pip is maybe not installed on your system. To install it, run

python3 -m ensurepip --upgrade

or on Linux:

sudo apt-get install python3-pip
note

Don't forget to replace python by python3 or py if needed, as we have seen previsouly.

If you are a more advanced user, you can also add pip to your PATH to run directly pip3 instead of python3 -m pip. In most cases it will be already added to your PATH!

Pipenv

Finally, we will install pipenv to replace pip. But why did you ask me to intall pip so?, you will ask me! Well, the answer is pretty simple: we need pip to install pipenv.

  1. First, run this command into PowerShell to install pipenv:
    python3 -m pip install --user pipenv
  2. Add the pipenv command to your PATH:
    [Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";$($(get-item $(python -m site --user-site)).parent.FullName)\Scripts", [EnvironmentVariableTarget]::User)
  3. Close and reopen your terminal to refresh the PATH.
  4. Finally let's test the installation:
    pipenv --version

That's it! You finished to install python, congratulations 🥳