Python Development Environment on WSL2

This Post guides you through how to setup a python development environment on Windows Sub-System for Linux(wsl2).

What is WSL2?

wsl2 lets a windows user use a virtual linux environment on Windows Machine itself. This is pretty handy feature for quic…


This content originally appeared on DEV Community and was authored by Gaurav Pande

This Post guides you through how to setup a python development environment on Windows Sub-System for Linux(wsl2).

What is WSL2?

wsl2 lets a windows user use a virtual linux environment on Windows Machine itself. This is pretty handy feature for quick development needs on your local machine.

Below Steps would list what all are the pre-requisites for achieving a python development environment on Windows Machine:

sudo apt update
sudo apt install python3 python3-pip python3-venv

NOTE : Above command will install python3 , pip tool and python virtual environment package.

  • To create a Virtual Environment Open the WSL2 Terminal and create your python project directory using command mkdir <YOUR_PROJECT_NAME> and then inside it run source .venv/bin/activate to activate the Virtual Environment where .venv is your virutal environment name.

NOTE: Recommendation is creating the virtual environment inside the directory in which you plan to have your project. Since each project should have its own separate directory, each will have its own virtual environment, so there is not a need for unique naming

  • To exit from virtual environment run on wsl2 terminal: deactivate

Reference: https://learn.microsoft.com/en-us/windows/python/web-frameworks


This content originally appeared on DEV Community and was authored by Gaurav Pande


Print Share Comment Cite Upload Translate Updates
APA

Gaurav Pande | Sciencx (2024-06-30T15:31:48+00:00) Python Development Environment on WSL2. Retrieved from https://www.scien.cx/2024/06/30/python-development-environment-on-wsl2/

MLA
" » Python Development Environment on WSL2." Gaurav Pande | Sciencx - Sunday June 30, 2024, https://www.scien.cx/2024/06/30/python-development-environment-on-wsl2/
HARVARD
Gaurav Pande | Sciencx Sunday June 30, 2024 » Python Development Environment on WSL2., viewed ,<https://www.scien.cx/2024/06/30/python-development-environment-on-wsl2/>
VANCOUVER
Gaurav Pande | Sciencx - » Python Development Environment on WSL2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/30/python-development-environment-on-wsl2/
CHICAGO
" » Python Development Environment on WSL2." Gaurav Pande | Sciencx - Accessed . https://www.scien.cx/2024/06/30/python-development-environment-on-wsl2/
IEEE
" » Python Development Environment on WSL2." Gaurav Pande | Sciencx [Online]. Available: https://www.scien.cx/2024/06/30/python-development-environment-on-wsl2/. [Accessed: ]
rf:citation
» Python Development Environment on WSL2 | Gaurav Pande | Sciencx | https://www.scien.cx/2024/06/30/python-development-environment-on-wsl2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.