Python virtualenv激活不起作用

Python virtualenv激活不起作用,python,powershell,virtualenv,Python,Powershell,Virtualenv,我正在尝试创建一个虚拟环境来测试api 我可以使用virtualenv test创建环境,然后我可以将cd放入其中。当我尝试运行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

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

我可以使用
virtualenv test
创建环境,然后我可以将cd放入其中。当我尝试运行
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,它用windows Powershell替换了cmd。我的virtualenv与cmd配合得很好,所以我怀疑这可能与Powershell的工作方式有关


如何激活virtualenv?

如果您按下
WindowsKey+R
,并在弹出框时键入
cmd
,它应该会显示命令行界面而不是powershell

  • 首先使用
    virtualenv pymote_env
  • 激活环境:
    pymote\u env\Scripts\Activate
  • 就你而言:-

    • 首先使用
      virtualenv测试制作virtualenv
    • 激活环境:
      test\Scripts\Activate

只需输入一个PowerShell命令

  • .\Scripts\activate

    不如

  • /脚本/激活


  • 使用命令pompt而不是power shell 并运行相同的命令


    这应该是可行的

    对于那些仍然感兴趣的人,输出将为您提供答案:

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


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

    如果按
    WindowsKey+R
    ,并在框出现时键入
    cmd
    ,它是否仍会显示powershell?否,它会显示cmd。我刚刚通过右键单击开始按钮导航到它。我看看它是否能通过命令行。它能在命令行中行。你应该把这个作为答案贴出来,这样我就可以接受了。非常感谢!很高兴它成功了!这很奇怪,powershell出现了。你打算用它做什么?这对我来说确实有效,因为我使用了
    \env\Scripts\activate
    ,但是有人能告诉我为什么我的poweshell会出现与上述问题相同的错误,因为它在今天之前工作正常。突然它开始给我这个错误。