为什么git bash不能将python安装路径转换为* nix表示法? [英] Why isn't git bash transforming the path to *nix notation for my python installation?

查看:126
本文介绍了为什么git bash不能将python安装路径转换为* nix表示法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 7上工作,我已经用git bash安装了git,然后又安装了python,在从命令行运行它时遇到了麻烦.这是到目前为止我学到的东西:

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:

  1. * nix使用:作为路径分隔符.

因此,C:/Users/Someone将被视为两条单独的路径.

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

* nix改用/c/users/someone表示法.

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

当我从git bash运行echo $PATH时,那里的每个路径(包括Node,在其他所有东西之后我才刚刚安装的节点)都使用正确的/c/表示法-

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

-Python除外,它仍然具有C:/表示法,因此无法从终端访问,因为找不到它.

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

当我进入环境变量并从操作系统的角度检查路径时,它们当然是 all (以C:/表示法).

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

git bash如何,在何处和/或为什么将它们全部转换为自己的符号 except python?我该如何解决?

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

此处是PATH,如Windows高级设置"中的环境变量"所示:

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

这是从git bash中看到的:

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

几乎可以看到,Python是唯一一个使用错误符号的人.

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

推荐答案

打开一个新的CMD,并设置所需的最小路径:

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%

(确保python.exe确实在C:\Users\Aerovistae\AppData\Local\Programs\Python\Python36-32中)

然后,键入bash,然后查看python.exe是否有效.

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

您还可以添加以前的路径,以识别引起麻烦的路径.
在OP的情况下,Python路径的领先位置是麻烦制造者.

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.

这篇关于为什么git bash不能将python安装路径转换为* nix表示法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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