Installing Python

Windows

Creating a new project

  1. To install Python on Windows, go to the Microsoft App Store (for example, Python 3.10).

  2. Then open PowerShell. If this is not installed, install is also using the Microsoft App Store (PowerShell).

  3. 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>
    
  4. Validate that Python is correctly installed. This command shows you the version number of the actively installed Python Interpreter.

    $ python3 --version
    
  5. 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

  1. 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>
    
  2. Then activate the virtual environment by running

$ venv/Scripts/Activate.ps1
  1. You can now run commands such as

$ pip install pyoptex

to install a package, or

$ python test.py

to 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

  1. To install Python on Linux (Ubuntu) follow this guide.

  2. Open a terminal (Ctrl+Alt+T)

  3. 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>
    
  4. Validate that Python is correctly installed. This command shows you the version number of the actively installed Python Interpreter.

    $ python3 --version
    
  5. 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

  1. 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>
    
  2. Then activate the virtual environment by running

$ source venv/bin/activate
  1. You can now run commands such as

$ pip install pyoptex

to install a package, or

$ python test.py

to run the Python script called “test.py” (which is located in your project folder).