在Windows命令行上运行但在Git Bash终端中没有的命令

时间:2016-05-13 06:39:23

标签: python git bash

我正在尝试在Git Bash中运行某些命令,但它们会继续挂起并且不显示任何内容。当我在Windows命令提示符下运行它们时,它们可以工作。

例如,在我的Windows命令提示符中

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\danie>python.exe
Python 2.7.11 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks an d https://anaconda.org
>>>

并且在Git Bash中它只是挂起......

danie@DESKTOP-36I511A MINGW64 ~
$ python

我尝试直接导航到存在命令的文件夹,尝试'python.exe',然后等待。

我还查看了Git Bash的PATH变量,python.exe位于Anaconda2文件夹中,我可以在下面看到run env|grep PATH.

danie@DESKTOP-36I511A MINGW64 ~
$ env|grep PATH
HOMEPATH=\Users\danie
MANPATH=/mingw64/share/man:/usr/local/man:/usr/share/man:/usr/man:/share/man:
PATH=/c/Users/danie/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/danie/bin:/c/Program Files/Dell/DW WLAN Card:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/WIDCOMM/Bluetooth Software:/c/Program Files/WIDCOMM/Bluetooth Software/syswow64:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files (x86)/Skype/Phone:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/110/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn:/c/Program Files/Microsoft SQL Server/120/Tools/Binn:/c/Program Files/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn/ManagementStudio:/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/c/Users/danie/Anaconda2:/c/Users/danie/Anaconda2/Scripts:/c/Users/danie/Anaconda2/Library/bin:/c/Users/danie/SQLite:/usr/bin/vendor_perl:/usr/bin/core_perl
EXEPATH=C:\Program Files\Git
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
ACLOCAL_PATH=/mingw64/share/aclocal:/usr/share/aclocal
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:/share/info:

其他命令也会发生这种情况。有时添加“交互式”会有所帮助,有时则不会。知道发生了什么事吗?

1 个答案:

答案 0 :(得分:1)

更新:我最后只是对有问题的Windows命令(python,sqlite3和其他一些)进行别名来解决输入winpty的问题。希望这是一个很好的解决方案。

为此,我在家中直接为Git Bash创建了一个.bash_profile文件,并对每个命令执行了类似的操作:alias sqlite3='winpty sqlite3.exe'