当我尝试从GIT bash mingw32激活我的virtualenv时,我没有得到预期的响应.
注意:py是我的Google云端硬盘文件夹中的Python项目文件夹.hy是我跑的时候制作的virtualenv文件夹virtualenv --distribute hy.
s3z@s3z ~/Google Drive/py/hy
$ Scripts/activate
Run Code Online (Sandbox Code Playgroud)
所以你看,之前没有预期的(hy) s3z@s3z ~/Google Drive/py/hy
s3z@s3z ~/Google Drive/py/hy
$ Scripts/activate.bat
Scripts/activate.bat: line 1: @echo: command not found
Scripts/activate.bat: line 4: syntax error near unexpected token `('
Scripts/activate.bat: line 4: `if not defined PROMPT ('
Run Code Online (Sandbox Code Playgroud)
当定位实际文件名时,activate.bat我收到错误消息.然后我尝试停用以查看发生了什么,因为我认为也许virtualenv被激活但隐藏了.
s3z@s3z ~/Google Drive/py/hy
$ Scripts/deactivate.bat
Scripts/deactivate.bat: line 1: @echo: command not found
Scripts/deactivate.bat: line 3: syntax error near unexpected token `('
Scripts/deactivate.bat: line 3: `if defined _OLD_VIRTUAL_PROMPT …Run Code Online (Sandbox Code Playgroud) 我一直在尝试使用匹配大小写而不是一百万个 IF 语句,但我尝试的任何操作都会返回错误:
match http_code:
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我还尝试过测试我发现的示例,这些示例也会返回此错误,包括以下错误:
http_code = "418"
match http_code:
case "200":
print("OK")
case "404":
print("Not Found")
case "418":
print("I'm a teapot")
case _:
print("Code not found")
Run Code Online (Sandbox Code Playgroud)
我知道匹配案例对于 python 来说是相当新的,但我使用的是 3.10,所以我不确定为什么它们总是返回这个错误。