<bdo id='mLfbK'></bdo><ul id='mLfbK'></ul>

    1. <i id='mLfbK'><tr id='mLfbK'><dt id='mLfbK'><q id='mLfbK'><span id='mLfbK'><b id='mLfbK'><form id='mLfbK'><ins id='mLfbK'></ins><ul id='mLfbK'></ul><sub id='mLfbK'></sub></form><legend id='mLfbK'></legend><bdo id='mLfbK'><pre id='mLfbK'><center id='mLfbK'></center></pre></bdo></b><th id='mLfbK'></th></span></q></dt></tr></i><div id='mLfbK'><tfoot id='mLfbK'></tfoot><dl id='mLfbK'><fieldset id='mLfbK'></fieldset></dl></div>

      <small id='mLfbK'></small><noframes id='mLfbK'>

      <tfoot id='mLfbK'></tfoot>

      <legend id='mLfbK'><style id='mLfbK'><dir id='mLfbK'><q id='mLfbK'></q></dir></style></legend>
    2. virtualenv v16.7.2 powershell activate 脚本:&quot;你必须'

      时间:2023-06-05

        • <bdo id='iUS1Q'></bdo><ul id='iUS1Q'></ul>
            • <legend id='iUS1Q'><style id='iUS1Q'><dir id='iUS1Q'><q id='iUS1Q'></q></dir></style></legend>
            • <tfoot id='iUS1Q'></tfoot>
                <tbody id='iUS1Q'></tbody>
            • <i id='iUS1Q'><tr id='iUS1Q'><dt id='iUS1Q'><q id='iUS1Q'><span id='iUS1Q'><b id='iUS1Q'><form id='iUS1Q'><ins id='iUS1Q'></ins><ul id='iUS1Q'></ul><sub id='iUS1Q'></sub></form><legend id='iUS1Q'></legend><bdo id='iUS1Q'><pre id='iUS1Q'><center id='iUS1Q'></center></pre></bdo></b><th id='iUS1Q'></th></span></q></dt></tr></i><div id='iUS1Q'><tfoot id='iUS1Q'></tfoot><dl id='iUS1Q'><fieldset id='iUS1Q'></fieldset></dl></div>

              <small id='iUS1Q'></small><noframes id='iUS1Q'>

              1. 本文介绍了virtualenv v16.7.2 powershell activate 脚本:&quot;你必须'source'这个脚本:PS&gt;..ENVScriptsactivate"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                python v.3.7.4 上最新版本的 virtualenv (16.7.2) 为activate.ps1"增加了 4 行.脚本,在 Windows10 powerhsell 上运行时会出现错误:You must 'source' this script: PS>..ENVScriptsactivate我该如何解决?(请注意,我已经阅读并完成了其他论坛问题以及与 windows 和 powershell 相关的 virtualenv 手册中提到的所有内容.)

                Newest version of virtualenv (16.7.2) on python v.3.7.4 has 4 additional lines for the "activate.ps1" script, which when run on Windows10 powerhsell gives the error: You must 'source' this script: PS> . .ENVScriptsactivate How do I fix this? (please note that I have read and done all that was mentioned on the other forum questions as well as the manual for virtualenv related to windows and powershell.)

                我已将执行策略设置为 RemoteSigned(按照其他论坛的建议):

                I have set the execution policy to RemoteSigned (as recommended in other forums):

                Get-ExecutionPolicy -List
                
                        Scope ExecutionPolicy
                        ----- ---------------
                MachinePolicy       Undefined
                   UserPolicy       Undefined
                      Process       Undefined
                  CurrentUser       Undefined
                 LocalMachine    RemoteSigned
                

                当我想激活 virtualenv 时,我运行 .ENVScriptsactivate

                When I want to activate virtualenv, I run .ENVScriptsactivate

                问题在于创建新虚拟环境时由 virtualenv 自动生成的 activate.ps1 脚本的第 3 到 6 行:

                The problem is with lines 3 to 6 of the activate.ps1 script that is auto generated by virtualenv when you make a new virtual environment:

                if (@($null,"Internal") -notcontains $myinvocation.commandorigin) {
                    Write-Host -Foreground red "You must 'source' this script: PS> . $($myinvocation.invocationname)"
                    exit 33
                }
                

                似乎 $myinvocation.commandorigin 设置为 Runspace 而不是 Internal

                It seems that $myinvocation.commandorigin is set to Runspace instead of Internal

                我该如何解决这个问题?有任何想法吗?谢谢 :)))请注意,我不想手动调整每个自动生成 activate.ps1 文件.

                How do I fix this? Any ideas? Thanks :))) Note that I don't want to manually adjust every auto-gen activate.ps1 file.

                推荐答案

                我们来看看那个错误信息:

                Let's have a look at that error message:

                您必须获取"此脚本:PS>..ENVScriptsactivate

                Hmmmm... - PS> 可能只是提示,给我们留下了这样的提示:

                Hmmmm... - PS> is probably just the prompt, which leaves us with this:

                  . .ENVScriptsactivate
                # ^
                # |
                # Check out this guy
                

                那个,路径前面那个孤独的.,也就是powershell中的dot-source operator.

                That, the lonely . in front of the path, that is the dot-source operator in powershell.

                根据 文档,它:

                在当前范围内运行脚本,以便将脚本创建的任何函数、别名和变量添加到当前范围内.

                Runs a script in the current scope so that any functions, aliases, and variables that the script creates are added to the current scope.

                我没有看过 virtualenv,但我认为它需要定义一些变量并确保这些变量在脚本运行后仍然存在,它需要运行在当前范围内.

                I haven't had a look at virtualenv, but I assume it'll want to define a number of variables and to ensure that these persist after the script has run, it needs to be run in the current scope.

                所以这是你必须运行的 literal 命令来修复它:

                So this is the literal command you have to run to fix it:

                . .ENVScriptsactivate
                

                这篇关于virtualenv v16.7.2 powershell activate 脚本:&quot;你必须'source'这个脚本:PS&gt;..ENVScriptsactivate"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 Python 3 中更改 Windows 10 背景 下一篇:在 Python 命令行上定义函数时出现语法错误

                相关文章

                <legend id='R12rX'><style id='R12rX'><dir id='R12rX'><q id='R12rX'></q></dir></style></legend>
                1. <tfoot id='R12rX'></tfoot>

                    • <bdo id='R12rX'></bdo><ul id='R12rX'></ul>
                    <i id='R12rX'><tr id='R12rX'><dt id='R12rX'><q id='R12rX'><span id='R12rX'><b id='R12rX'><form id='R12rX'><ins id='R12rX'></ins><ul id='R12rX'></ul><sub id='R12rX'></sub></form><legend id='R12rX'></legend><bdo id='R12rX'><pre id='R12rX'><center id='R12rX'></center></pre></bdo></b><th id='R12rX'></th></span></q></dt></tr></i><div id='R12rX'><tfoot id='R12rX'></tfoot><dl id='R12rX'><fieldset id='R12rX'></fieldset></dl></div>

                    <small id='R12rX'></small><noframes id='R12rX'>