Python
Let's install Python! Python is a very easy-to-learn language, that we used to serve the website.
Install Python
Be sure to select the correct version!
You can find the version required for Nantral Platform in the file
backend/.python-version
.
Currently, we use Python 3.10.
- Windows
- MacOS
- Linux
Download and install the Python version from the Microsoft Store.
Download and install Python from the official website. Make sure to check the "Add python to the PATH" option during the installation!
MacOS has already python installed, but sometimes it is the Python2 version. Unfortunately, it is not compatible with Python3, so you have to install both versions side by side. If it does not work the first time, you can find tutorials on Internet to solve it.
Python should be already installed on your system. If it is not the case, run in a terminal:
sudo apt update
sudo apt install python3 python3-pip
If you need to install multiple versions of python,
you can use pyenv
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.
Install Pipenv
Pipenv will be our dependency manager, to handle dependencies of the project.
- Windows
- MacOS/Linux
- Ensure that
pip
is correctly installed and upgrade it:python3 -m ensurepip --upgrade
- Then, run this command into PowerShell to install
pipenv
:python3 -m pip install --user pipenv
- Add the
pipenv
command to your PATH:[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";$($(get-item $(python -m site --user-site)).parent.FullName)\Scripts", [EnvironmentVariableTarget]::User)
- Close and reopen your terminal to refresh the PATH.
- Finally let's test the installation:
pipenv --version
-
First, install pipx to manage Python applications:
- follow the official instructions here
-
Then, install pipenv:
pipx install pipenv
-
Check pipenv is correctly installed, and that it is accessible in the PATH:
pipenv --version
If pipenv is not correctly installed...
If it does not work, you might need to add pipenv
to your PATH. To do this,
you will edit your profile configuration file (~/.bashrc
or ~/.zshrc
).
At the end of the file, add this line:
export PATH="$PATH:$(python3 -m site --user-base)/bin"
Close and restart your terminal, and test again to run pipenv
.
If it still doesn't work, replace the previous line by this one:
export PATH="$PATH:$(python3 -m site --user-site)"
That's it! You finished to install python, congratulations 🥳