Commands working on windows command line but not in Git Bash terminal

2024/11/15 6:32:31

I am trying to run certain commands in Git Bash but they continue to hang and not display anything. When I run them in the Windows command prompt they work.

For example, in my windows command prompt the

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

and in Git Bash it just hangs...

danie@DESKTOP-36I511A MINGW64 ~
$ python

I have tried navigating directly in to the folders where the commands exist, trying 'python.exe', and waiting.

I have also looked at the PATH variables for Git Bash, and python.exe is inside of the Anaconda2 folder which I can see below when I 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:

This happens with other commands too. Sometimes adding "interactive" helps, other times it doesn't. Any idea what is going on?

Answer

Update: I ended up just aliasing the problematic windows commands (python, sqlite3, and some others) to get around typing winpty. Hopefully this is an OK solution.

To do this, I created a .bash_profile file in the home directly for Git Bash, and did something like this for each command: alias sqlite3='winpty sqlite3.exe'

https://en.xdnf.cn/q/72135.html

Related Q&A

RBF interpolation: LinAlgError: singular matrix

The following call:rbf = Rbf(points[0], points[1], values,epsilon=2)results in an error:LinAlgError: singular matrixwith the following values:In [3]: points Out[3]: (array([71, 50, 48, 84, 71, 74, 89,…

What does `\x1b(B` do?

Im a Blessed user, and recently, when I tried to find out the contents of the term.bold() function, I got this output: \x1b[1m\x1b(B\x1b[mI understand what \x1b[1m and \x1b[m do, but what does \x1b(B d…

Not clicking all tabs and not looping once issues

I am trying to click the tabs on the webpage as seen below. Unfortunately, it only seems to click some of the tabs despite correct correct xpath in inspect Chrome. I can only assume it’s not clickin…

Opencv stream from a camera connected to a remote machine

I am developing a wx application in python for streaming and displaying video from two different webcams. This works fine, but now I need to do this in a different scenario in which the two cameras are…

Is there a callable equivalent to f-string syntax?

Everybody loves Python 3.6s new f-strings:In [33]: foo = {blah: bang}In [34]: bar = blahIn [35]: f{foo[bar]} Out[35]: bangHowever, while functionally very similar, they dont have the exact same semanti…

Python: list comprehension based on previous value? [duplicate]

This question already has answers here:Python list comprehension - access last created element(9 answers)Closed 10 months ago.Say I want to create a list using list comprehension like:l = [100., 50., 2…

How to run a coroutine inside a context?

In the Python docs about Context Vars a Context::run method is described to enable executing a callable inside a context so changes that the callable perform to the context are contained inside the cop…

Random Forest interpretation in scikit-learn

I am using scikit-learns Random Forest Regressor to fit a random forest regressor on a dataset. Is it possible to interpret the output in a format where I can then implement the model fit without using…

Why are three apostrophes needed for print in Python?

Im making this Pythagoras Theorem Calculator in Python 3.3.2.I made print over several lines so that I could make a diagram:print("Welcome to the Pythagoras Theorem Calculator, powered by Python!&…

Downloading files from public Google Drive in python: scoping issues?

Using my answer to my question on how to download files from a public Google drive I managed in the past to download images using their IDs from a python script and Google API v3 from a public drive us…