Environment
Environment Manager
While working with python it is recommended to setup a local development environment. This can be achieved with a variety of environment managers such as:
The use of Miniconda
is suggested as it is minimal, lightweight and simple to setup.
Moving forward, this documentation will assume that you are working with Miniconda
as your environment manager.
Setting up a New Environment
After installing Miniconda
you are able to create a new environment with the following command:
conda create -n <ENVIRONEMNT_NAME> python==3.12
Replace <ENVIRONMENT_NAME> with the name of your choice.
You will be prompted to proceed with package installations required to setup Python like such:
This will conveniently create a new environment with Python3.12 installed and you should see the following prompt:
Activating and Using the Environment
Following the successful prompt from above, you are able to start the environment by running the command:
conda activate <ENVIRONMENT_NAME>
If you are using VSCode, you will have to point the Python interpreter to the one installed in the environment.
This can be achieved by pressing Ctrl + Shift + P
(Windows/Linux) or CMD + Shift + P
(MacOS), and entering Python: Select Interpreter
.
This will bring down a list of options of interpreters, select the relevant interpreter to your environment.
For an Example: