【问题标题】:Error after installing virtualenv on vscode在 vscode 上安装 virtualenv 后出错
【发布时间】:2021-05-08 18:32:03
【问题描述】:

我是编程新手,在我的 vscode 中安装 virtualenv 后遇到此错误。请帮帮我。

virtualenv : The term 'virtualenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.
At line:1 char:1
+ virtualenv myprojectenv
+ ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (virtualenv:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

【问题讨论】:

标签: python python-2.7 virtualenv


【解决方案1】:

当您只是在 powershell 或命令提示符下输入 virtualenv myproject 时,它不知道该代码实际上与哪个程序有任何关系(而且它不是它识别的代码。

如果你在 python3 中使用python -m virtualenv myprojectenv(在 python 2 中)或 python -m venv myprojectenv,你应该会成功。这将调用 python 和名为 virtualenv 的模块(-m)。

这将在您的 powershell 当前所在的目录中创建虚拟环境文件夹。因此,如果您的 powershell 位于 C:\users\xxx>,它就会在那里。因此,您应该确保在制作之前导航到您想要的位置。

编辑:添加版本

【讨论】:

  • 非常感谢
猜你喜欢
  • 1970-01-01
  • 2011-05-08
  • 2018-10-14
  • 2017-10-17
  • 1970-01-01
  • 2022-11-01
  • 2021-10-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多