无法激活GIT bash mingw32 for Windows中的virtualenv [英] Can not activate a virtualenv in GIT bash mingw32 for Windows

查看:292
本文介绍了无法激活GIT bash mingw32 for Windows中的virtualenv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试从GIT bash mingw32激活我的virtualenv时,我没有得到预期的响应。注意: py 是我的Google云端硬盘文件夹中Python项目的文件夹。 hy 是当我运行 virtualenv --distribute hy 时创建的virtualenv文件夹。

  s3z @ s3z〜/ Google Drive / py / hy 
$脚本/激活

所以,您会发现,在 s3z @ s3z〜/ Google Drive / py / hy

  s3z @ s3z〜/ Google Drive / py / hy 
$脚本/ activate.bat
Scripts / activate.bat:第1行:找不到命令
Scripts / activate.bat:第4行:语法错误附近的意外标记`('
Scripts / /activate.bat:第4行:`如果没有定义PROMPT('

activate.bat 我得到了错误信息,然后我尝试关闭以查看会发生什么,原因可能是virtualenv已被激活但隐藏。

  s3z @ s3z〜/ Google Drive / py / hy 
$ Scripts / deactivate.bat
Scripts / deactivate.bat:line 1:@echo :命令未找到
Scripts / deactivate.bat:第3行:语法错误附近的意外标记`('
Scripts / deactivate.bat:第3行:`if defined _ OLD_VIRTUAL_PROMPT('

s3z @ s3z〜/ Google Drive / py / hy
$ Scripts / deactivate
sh.exe:Scripts / deactivate:No such file or directory

有什么想法吗?

解决方案使用 Scripts / activate 在shell的新实例中运行脚本,该脚本在脚本执行后被销毁。要在当前shell中运行脚本,请使用。脚本/激活源脚本/激活

Scripts / activate.bat 在这里不起作用,因为它是用Batch,Windows cmd.exe 语言编写的,而不是Bash。


When I try to activate my virtualenv from GIT bash mingw32 I do not get the expected response.

NOTE: py is the folder for Python projects in my Google Drive folder. hy is the virtualenv folder that was made when I ran virtualenv --distribute hy.

s3z@s3z ~/Google Drive/py/hy
$ Scripts/activate

So you see, there is no expected (hy) that appears before 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 ('

And when targeting the actual file name activate.bat I get error messages. Then I try deactivating to see what happens cause I thought maybe virtualenv was activated but hidden.

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 ('

s3z@s3z ~/Google Drive/py/hy
$ Scripts/deactivate
sh.exe": Scripts/deactivate: No such file or directory

Any ideas?

解决方案

Doing Scripts/activate runs the script in a new instance of the shell, which is destroyed after the script execution. To run the script in your current shell, use either . Scripts/activate or source Scripts/activate.

Scripts/activate.bat does not work here because it is written in Batch, Windows cmd.exe language, and not Bash.

这篇关于无法激活GIT bash mingw32 for Windows中的virtualenv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆