在我的 Windows 命令提示符中创建了一个虚拟环境“测试”,但 workon test 无法在 Visual Studio 代码中工作?怎么解决?

问题描述 投票:0回答:2

错误:PS C:\Users\ARYAN\projects\project1> 进行测试 workon :术语“workon”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。检查名称的拼写,或者路径是否
包括,验证路径是否正确,然后重试。 在行:1 字符:1

  • 测试中
  •   + CategoryInfo          : ObjectNotFound: (workon:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
django powershell visual-studio-code virtualenv virtualenvwrapper
2个回答
0
投票

workon 也对我不起作用。 因此,我尝试了另一种方法来激活我的虚拟环境。 按 Ctrl+Shift+P 然后选择Python:选择解释器。 然后选择您的环境。如果您无法从列表中找到您的环境,您可以输入解释器路径,例如“C:\Users\user env\Scripts\python.exe”

最后,重新打开 VS 瞧!

查看他们的文档 https://code.visualstudio.com/docs/python/environments


0
投票

试试这个:- 1.) 用于创建 Virtualenv

py -m venv project_name

2.) 用于激活要处理的项目

.\project_name\scripts\activate
© www.soinside.com 2019 - 2024. All rights reserved.