--Build a python development environment on windows ――I want to separate the environment for each project --I don't want to use Anaconda --There is a feeling too much --There are few examples written on the premise of conda when doing research (I feel like)
Summary ――I tried various things, but decided that WSL2, Ubuntu20.04, pipenv, Visual Studio Code are easy to use. --The process I tried is not described --Only the procedure will be described, and if you get used to it, you can build it in about 5 minutes.
--Windows 10 Home (around 2020/10) --VisualStudioCode (hereinafter VSCODE) must be installed
--Set up the WSL2 environment (this takes the longest time)
-* Even if you did not enter the Insider Program, you could use WSL2 on Win10 Home before you knew it.
――This is the most helpful procedure
--Search for and install Ubuntu 20.04 from the Microsoft Store
--If you can start Ubuntu 20.04 safely, update it.
$ sudo apt update
$ sudo apt upgrade
-* Note that if CPU virtualization is not set to ENABLE in the BIOS, an error will occur at startup.
--python3 is installed by default
sudo apt install python3-pip
--Install pipenv with pip3
--Install with sudo
-[Reference site](https://www.it-swarm.dev/ja/python/pipenv%EF%BC%9A%E3%82%B3%E3%83%9E%E3%83%B3%E3% 83% 89% E3% 81% 8C% E8% A6% 8B% E3% 81% A4% E3% 81% 8B% E3% 82% 8A% E3% 81% BE% E3% 81% 9B% E3% 82% 93/834117829/)
--Create an arbitrary project folder
$ mkdir ~/work/python-test
$ cd ~/work/python-test
pipenv --python=/usr/bin/python3--FIXME: pipenv --python 3 will go to see python on windows, so specify it explicitly -Reference site --Confirm that the Pipfile has been generated --Install any package you want to use
pipenv install [package]--Confirm that the Pipfile.lock file has been generated --Install VSCODE extensions
$ codeon Ubuntu, open the folder on Ubuntu with VSCODE --Method 3: Move to the project folder on Ubuntu and
$ code .-* VS CODE server program is automatically installed when the code command is executed for the first time. --Install extensions for python development in VSCODE --At least "ms-python.python" is required -* Please note that the extension itself needs to be installed for each connection destination. --Create an appropriate python file in the project folder and start development (**. Py) --In the python interpereter at the bottom left, select the one with ([directory name]: pipenv) (the first time it is not pipenv)
$ pipenv install, the dependent modules will be installed automatically and the development environment will be created. --When deleting a virtual environment
$ pipenv --rm--Location of modules to be installed
~ / .local / share / virtualenvs / [folder name]-[random string]--If you want to put it under the project folder -
$ export PIPENV_VENV_IN_PROJECT=true--Initialize under the project folder --A .venv folder will be created under the project folder, and it will be installed in it.