Installing Python
Windows
Creating a new project
To install Python on Windows, go to the Microsoft App Store (for example, Python 3.10).
Then open PowerShell. If this is not installed, install is also using the Microsoft App Store (PowerShell).
Then go to the folder where you want to create your code. Use the command cd to change directory. Replace the <> with the Windows path.
$ cd <path to your project>
Validate that Python is correctly installed. This command shows you the version number of the actively installed Python Interpreter.
$ python3 --version
Then create a virtual environment. See the Official Python documentation for more information. The command below creates a folder called “venv” which acts as your virtual environment.
$ python3 -m venv venv
Every time, to activate the project
Go to the folder where your project is located if not already. You should have a folder called “venv”. If not, please see the previous section.
$ cd <path to your project>
Then activate the virtual environment by running
$ venv/Scripts/Activate.ps1
You can now run commands such as
$ pip install pyoptexto install a package, or
$ python test.pyto run the Python script called “test.py” (which is located in your project folder).
Linux
The steps are fairly similar to the Windows installation.
Creating a new project
To install Python on Linux (Ubuntu) follow this guide.
Open a terminal (Ctrl+Alt+T)
Then go to the folder where you want to create your code. Use the command cd to change directory. Replace the <> with the Linux path.
$ cd <path to your project>
Validate that Python is correctly installed. This command shows you the version number of the actively installed Python Interpreter.
$ python3 --version
Then create a virtual environment. See the Official Python documentation for more information. The command below creates a folder called “venv” which acts as your virtual environment.
$ python3 -m venv venv
Every time, to activate the project
Go to the folder where your project is located if not already. You should have a folder called “venv”. If not, please see the previous section.
$ cd <path to your project>
Then activate the virtual environment by running
$ source venv/bin/activate
You can now run commands such as
$ pip install pyoptexto install a package, or
$ python test.pyto run the Python script called “test.py” (which is located in your project folder).