当前位置:网站首页>Pycharm terminal enables virtual environment

Pycharm terminal enables virtual environment

2022-07-07 16:25:00 Bashan queer dialect

When building a new project , Select new virtual environment

When the project opens , Start the terminal , But often found , The virtual environment is not turned on , As a result, some packages are installed in the global environment .

One solution is to manually start the virtual environment

If there is an error opening , Such as “ Disable scripts from running ” Or do not recognize the command , Just open it as an administrator powershell, Then run the following command

set-executionpolicy remotesigned

Set to “y” that will do

But at this time , If you want to shut down the virtual environment by command

  It often doesn't work , It is also necessary to manually shut down the terminal , And on again , Will shut down the virtual environment

Various reasons are not studied in detail ( It should be a matter of authority ), But it's been tested , If the terminal is replaced with cmd, There is basically no problem above

  • Open the project , The virtual environment will be opened by default
  • The commands to open and close the virtual environment can work normally

The replacement method is “File-settings-Tool-Terminal”

here , Close the terminal in the project , And on again , Just use cmd Terminal

But here's the thing

For existing projects , Even if the terminal is modified to cmd, Open again , The startup environment may still not take effect

There is no problem with creating new projects

in addition , Try not to create the project under the Chinese Directory

原网站

版权声明
本文为[Bashan queer dialect]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071410486498.html