virtualenv 激活不起作用

新手上路,请多包涵

我正在尝试创建一个虚拟环境来测试 api。

我可以使用 virtualenv test 很好地创建环境,然后我可以进入它。当我尝试运行 activate 时,出现此错误:

 PS C:\Users\Bright Bridge\Desktop\autocomplete_demo\Scripts> activate
activate : The term 'activate' 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
+ activate
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (activate:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Suggestion [3,General]: The command activate 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: ".\activate". See "get-help about_Command_Precedence" for more details.

我最近更新了 windows,并将 cmd 替换为 Windows Powershell。我的 virtualenv 在 cmd 上运行良好,所以我怀疑它可能与 Powershell 做事的方式有关。

如何激活 virtualenv?

原文由 wanderer0810 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1k
2 个回答

如果你按 WindowsKey + R ,然后输入 cmd 当框出现时,它应该调出命令行界面而不是 powershell!

原文由 AetherUnbound 发布,翻译遵循 CC BY-SA 3.0 许可协议

对于那些仍然感兴趣的人,输出会给你答案:

如果您信任此命令,请改为键入:“.\activate”。

所以使用相对路径名在powershell中运行激活脚本,或者使用绝对路径

原文由 Bugbeeb 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏