# Setting up python10 environment in VS code
###### tags: `Tools`
## Usage
#### Install WSL
+ [使用 WSL 在 Windows 上安裝 Linux](https://learn.microsoft.com/zh-tw/windows/wsl/install)
#### Install Python
+ [How to Install Python 3.10 in Ubuntu and Other Related Linux](https://www.debugpoint.com/install-python-3-10-ubuntu/)
```bash
# download python3.10
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.10
# set python default version
python --version
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
sudo update-alternatives --config python
python version
```
+ you may face some problems while using `pip`:
+ [no module named distutils....but distutils installed?](https://stackoverflow.com/questions/69919970/no-module-named-distutils-but-distutils-installed)
```bash
sudo apt-get install python3.10-distutils
```
#### Download VS code and add it to PATH
+ [Download Visual Studio Code](https://code.visualstudio.com/download)
+ Get belows extensions in VS code:
+ Python
+ Pylance
+ WSL
+ Tabnine
+ Run
#### Setup venv
+ create venv under a wsl session:
```bash
# make a project directory
mkdir playground
cd playground
# setup environment
python -m venv venv
# make sure the venv was built up
tree venv
```
#### Open the project via VS code
+ In previous project directory
```bash
# acticvate the env first
source venv/bin/activate
code .
# if you did't add vs code to path it won't work here
```
#### Setup the linter config
+ Open settings.json of workspace and add below:
```json
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.pycodestyleEnabled": true,
"python.linting.banditEnabled": true,
"python.analysis.typeCheckingMode": "basic", // Pylance
"editor.rulers": [79]
```
+ make sure save with Ctrl + S