无法从虚拟环境 python django 退出。(尝试停用、源停用和退出没有任何效果)

Not able to exit from virtual environment python django.(Tried Deactivate,source deactivate and exit nothing worked)

我正在尝试退出为 运行 我的 Django 应用程序创建的虚拟环境。现在我无法退出它。我已经尝试了所有命令停用、源停用、退出(只是为了确保在我的情况下一切正常)。我什至删除了所有虚拟环境,因为我无法退出。但是,我仍然无法退出它。

环境:Python3.7.2(不是蟒蛇),WindowsOS

提前致谢。

下面是错误信息:

deactivate : 术语 'deactivate' 未被识别为 cmdlet 的名称, 函数、脚本文件或可运行的程序。检查名称的拼写,或者如果 包含路径,请验证路径是否正确,然后重试。 在 line:1 char:1 + 停用 + ~~~~~~~~~~

+ CategoryInfo          : ObjectNotFound: (deactivate:String) [], CommandNotFoundE

异常 + FullyQualifiedErrorId:CommandNotFoundException

停用不是 Python 命令,而是 shell 命令。你必须activate/deactivate终端shell环境,而不是Pythonshell.

将您的目录更改为脚本并停用。

@BlackBoxSql sugeested 对我有用。 在终端中,输入

cd C:\Users\John\hello_w\.venv\Scripts

然后按回车键(使用正确的目录)。然后它说:

Suggestion [3,General]: The command deactivate was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\deactivate". See "get-help about_Command_Precedence" for more details.

这对我有用。