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.
If you haven’t already, download and install Python 3.11 : https://www.python.org/
If you have a different version of Python installed:
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 : https://docs.python.org/3.10/tutorial/controlflow.html#match-statements ).
Python 3.10: You’re probably fine. Probably. Use at your own risk.
Python 3.12 or higher: You’re probably fine. Probably. Use at your own risk.
Open the console in the repository root.
Example:
C:\Users\Username\computer-vision-python
Create a virtual environment called
venv
by running:[python] -m venv venv/
, where[python]
is Python 3.11 (e.g.python
,python311
).You can check which version of Python it is by running
[python] --version
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 thevenv
directory and repeat this step for a fresh environment.If you have to change the Python version of your virtual environment, delete it and repeat this step with the new Python version.
Do not use any name other than
venv
. Otherwise the linters and formatters will break.
Â