git bash 安装python,为什么git bash不将python安装路径转换为* nix表示法?

Working on Windows 7, I've installed git with the git bash and then installed python and am having trouble running it from the command line. Here's what I've learned so far:

*nix uses : as a path separator.

Therefore C:/Users/Someone would be seen as two separate paths.

*nix uses /c/users/someone notation instead.

When I run echo $PATH from git bash, every path there (including Node, which I only just installed now, after everything else) is using the correct /c/ notation--

--except Python, which still has the C:/ notation, and is therefore not accessible from the terminal since it can't find it.

When I go to Environment Variables and check the path from the os's perspective, they are of course all in C:/ notation.

How, where, and/or why is git bash converting all of them to its own notation except python? How can I fix this?

Here is PATH as seen in Environment Variables in Windows Advanced Settings:

C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\; C:\Users\Aerovistae\AppData\Local\Programs\Python\Python36-32;C:\Users\Aerovistae\AppData\Roaming\npm

Here it is as seen from git bash:

/c/Users/Aerovistae/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Aerovistae/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/cmd:/c/Program Files (x86)/Skype/Phone:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Program Files/nodejs:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon: C:/Users/Aerovistae/AppData/Local/Programs/Python/Python36-32:/c/Users/Aerovistae/AppData/Roaming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl

You can see near the end that Python is the only one with the wrong notation.

解决方案

Open a new CMD, and set the minimal PATH you need:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

set GIT_HOME=C:\Path\to\Git

set PATH=%GIT_HOME%;%GIT_HOME%\bin;%GIT_HOME%\usr\bin;%PATH%

SET PATH=C:\Users\Aerovistae\AppData\Local\Programs\Python\Python36-32;%PATH%

(Make sure python.exe is indeed in C:\Users\Aerovistae\AppData\Local\Programs\Python\Python36-32)

Then, type bash, and see if python.exe works.

You can also add your previous paths, to identify the one causing trouble.

In the OP's case, the stray leading space for the Python path was the troublemaker.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值