2016-05-13 129 views
2

我想在Git Bash中運行某些命令,但他們繼續掛起而不顯示任何東西。當我在Windows命令提示符下運行它們時,它們工作正常。命令工作在Windows命令行,但不是在Git Bash終端

例如,在我的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它只是掛起...

[email protected] MINGW64 ~ 
$ python 

我曾嘗試直接到命令存在的文件夾瀏覽,試着'python.exe',然後等待。

我也看了GIT中猛砸PATH變量,python.exe是Anaconda2文件夾,我可以看到下面的時候我run env|grep PATH.

[email protected] 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: 

這種情況與其他命令太裏面。有時添加「交互式」有助於其他時間,但不會。任何想法是怎麼回事?

+0

你吃過看看這個類似的問題? http://stackoverflow.com/questions/32597209/python-not-working-in-the-command-line-of-git-bash 看起來好像它可能與ncurses支持中的錯誤有關。滾動到18 upvotes的答案,看看它是否有幫助... – Greg

+0

我昨天看到那篇文章,但只是嘗試在我的命令之前添加「winpty」第一次,它的工作!我現在可以在Git Bash中運行我的命令。 雖然在所有的命令之前輸入「winpty」是非常煩人的,但是如何解決這個問題?我會在另一個線程中詢問。感謝您的幫助! – dgloven

+0

更新:我最終只是混淆有問題的Windows命令(python,sqlite3和其他一些)以避免輸入winpty。希望這是一個好的解決方案。 – dgloven

回答

0

更新:我結束了鋸齒有問題的Windows命令(python,sqlite3和其他一些)來繞過輸入winpty。希望這是一個好的解決方案。

要做到這一點,我創建直接在家裏的Git Bash的一個.bash_profile文件中,並沒有這樣的事情每個命令:alias sqlite3='winpty sqlite3.exe'