/
Python setup and virtual environment

Python setup and virtual environment

A Python virtual environment is a self contained environment with a specific Python version and package versions. Different virtual environments can be used for different projects to maintain consistency.

  1. If you haven’t already, download and install Python 3.11 : Welcome to Python.org

    1. If you have a different version of Python installed:

      1. Python 3.9 or lower: You must install Python 3.11 (you do not need to uninstall the other version(s)). This is because of a language feature dependency (specifically, match statements introduced in Python 3.10 : 4. More Control Flow Tools — Python 3.10.16 documentation ).

      2. Python 3.10: You’re probably fine. Probably. Use at your own risk.

      3. Python 3.12 or higher: You’re probably fine. Probably. Use at your own risk.

  2. Open the console in the repository root.

    1. Example: C:\Users\Username\computer-vision-python

  3. Create a virtual environment called venv by running: [python] -m venv --system-site-packages ./venv , where [python] is Python 3.11 (e.g. python , python311 ).

    1. You can check which version of Python it is by running [python] --version

    2. If you move the repository to a different path after creating a virtual environment, you will have to delete the venv directory and repeat this step. Additionally, if your virtual environment breaks for any reason, you can always delete the venv directory and repeat this step for a fresh environment.

      1. If you have to change the Python version of your virtual environment, delete it and repeat this step with the new Python version.

    3. Do not use any name other than venv . Otherwise the linters and formatters will break.

 

Related content

Cloning the repository
Cloning the repository
More like this
Software
Software
Read with this
Python Repository
Python Repository
More like this
Autonomy Workflow Software
Autonomy Workflow Software
Read with this
Activate the Python virtual environment
Activate the Python virtual environment
More like this
Autonomy Github Starting Guide
Autonomy Github Starting Guide
More like this