windows10 Next in VScode Internal configuration python A virtual environment
One 、 edition
1、windows10
2、VScode1.53.2
3、python3.9.6
Two 、 It suddenly occurred to me that the original intention of configuring this environment is to pytest Automated testing , I hope to take time to study every week , And produce one or more learning articles
3、 ... and 、 To configure
1、 install python
2、 install Code Runner plug-in unit
3、 stay terminal Type in python -m venv fish_venv( The file name you want to create )
( Apple computer input python3 -m venv fish_venv( The file name you want to create ))
Generate the file on the side
4、 Apple computer directly type source ./fish_venv( Your file name )/bin/activate Enable virtual environment
windows turn 5
5、windows System typing source ./fish_venv( Your file name )/bin/activate Will report a mistake
as a result of Windows In the system , It's through .\venv( Your file name )\Scripts\activate Command to enter the virtual environment , Because it's running activate.bat It will be generated in the same level directory activate.ps1,PowerShell Execution is not allowed by default *.ps1 Script files . You need to set Power Shell: Run as administrator Power Shell
type set-executionpolicy remotesigned command , And select Y
6、 Activate after execution vscode Medium terminal, It will be activated by default venv A virtual environment
7、 If you want to exit the virtual environment , stay terminal Type in deactivate