Python virtual environment setup for complete beginners
The easy way to setup a python virtual environment using Conda on Windows
Setup Python virtual environment on Windows
Step 1: Install Miniconda for windows.
There are two options to install Miniconda
a) Download and install Minconda executable file from here. Select the file corresponding to the windows platform.
b) Run the shell command on Windows command prompt.
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
start /wait "" miniconda.exe /S
del miniconda.exeStep 2: Setup virtual environment
Open Anaconda Prompt (MiniConda3). Search for anaconda at the search bar to find it.
Create a python virtual environment using the following command.
conda create -n playground python=3.10The above command creates a virtual environment named playground. Change the python version as needed. To see where the environment is created, run
conda env list.Activate the virtual environment using
conda activate playground
Once the environment is active, you can install python packages using pip install [package name]. Example, to install Jupyter packages, run pip install jupyter
Step 3: Setup visual studio code
Download and install visual studio code from here. Download the windows version.
Point visual studio code to a folder. Create a new folder if you don’t one already.
VS Code will ask to install a python extension, please follow the steps and installl the extension.
Create a new .py or jupyter (.ipynb) file. VS code will prompt you to install python and jupyter extensions. Install the extensions.
Select the kernel corresponding to the environment you have created earlier. There is a select kernel button on the VS code studio UI. When you click it, it will show you the list of virtual environments available to select.
Now you are ready to write your code.
print(“hello world!”)
If you have found any of the steps wrong, please let me know I will be happy to update the post based on your feedback. Happy coding and may the compiler be with you!

