I think you often use venv in python development, Even when I looked it up, there was a lot of information about Mac, so I would like to summarize the construction procedure for the windows version. I will also summarize how to use VS Code. The installation procedure of python etc. is omitted.
I referred to the following article. https://qiita.com/fiftystorm36/items/b2fd47cf32c7694adc2e https://qiita.com/some-nyan/items/7f20fa5fa0b6e451a42b https://qiita.com/Avocado/items/3e71870815d6c54c1eea
C: \ pythondev \ 001
)venv
.RemoteSigned
.
Open PowerShell with administrator privileges and run Set-ExecutionPolicy RemoteSigned
.PowerShell Language Support for Visual Studio Code
.python -m venv {directory name}
{Directory name} specifies the installation destination.
In this example, it is python -m venv venv
.Confirmation with VS Code
Change the terminal shell to PowerShell.
If the directory where venv is installed is displayed as shown below, it is successful.
(venv) PS C:\pythondev\001>
How to check on the command line
Go to the created working folder
.\venv\Scripts\activate
By executing, it becomes a venv environment.
You can exit with the following command.
.\venv\Scripts\deactivate
Recommended Posts