PyCharm + WSL2 on Windows
WSL2 lets you run Python in a Linux environment while using PyCharm on Windows. This is useful when:
- Your production server runs Linux and you want to match the environment
- Python packages you need have Linux-only dependencies
- You need Linux system tools (bash scripts, make, gcc) in your workflow
Configure PyCharm with WSL2 on Windows
- 1
Install WSL2 and a Linux distro
PS> wsl --install# Installs WSL2 + Ubuntu by default. Reboot required. - 2
Install Python in WSL
user@pc:~$ sudo apt update && sudo apt install python3 python3-pip python3-venv - 3
Open project in WSL from PyCharm
In PyCharm: File → Settings → Project → Python Interpreter → gear icon → Add Interpreter → On WSL. Select your Linux distro and Python executable.
- 4
Open terminal in WSL
PyCharm terminal: click the + dropdown → WSL. This gives you a bash terminal inside WSL2.
WSL questions
PyCharm WSL interpreter — Community or Professional only?
WSL interpreter support is available in both Community and Professional editions of PyCharm. You do not need Professional to use WSL2 as your Python interpreter.
pycharm wsl — is it slow?
PyCharm with WSL2 can be slower than native Windows Python for file-heavy operations if your project is on the Windows filesystem (/mnt/c/...). For best performance, store your project inside the WSL2 filesystem (~/projects/...). File access within WSL2's own filesystem is fast.