python sys.executable inconsistency if called from cmd

Andrey Repin
Wed Feb 3 15:27:48 GMT 2021

Greetings, Lemke, Michael  SF/HZA-ZIC2!

> I don't know anything about python but want to use cygwin's
> python from nodejs with npm-gyp. The npm-gyp module is trying to
> find the python executable path from sys.executable and fails.

If that's true, then it should be fixed upstream.

> While investigating this I found this to me quite inconsistent
> behavior:

> cygwin> /bin/python3.6m.exe -c 'import sys; print(sys.executable);'
> /bin/python3.6m

> cygwin> python3.6m -c 'import sys; print(sys.executable);'
> /usr/bin/python3.6m

> cygwin> python3.6 -c 'import sys; print(sys.executable);'
> /usr/bin/python3.6

> cygwin> python3.6m.exe -c 'import sys; print(sys.executable);'
> /usr/bin/python3.6m

> cmd> c:/MyStuff/NCygwin64/bin/python3.6m.exe -c 'import sys; print(sys.executable);'
> /usr/bin/python3.6m

> cmd> rem add cygwin path to Windows:
> cmd> path %PATH%;c:\MYSTUFF\ncygwin64\bin

> cmd> python3.6m.exe -c 'import sys; print(sys.executable);'
> /c/MYSTUFF/ncygwin64/bin/python3.6m

> With CMD I'll never get an executable that actually works from cmd.
> Is this expected?

Yes. This is Cygwin, not Windows CMD.

> Is there a way around to make this work?

Yes, write scripts correctly, correctly translate paths.

> FAQ:        
> Documentation:

Specifically see `man cygpath`.

With best regards,
Andrey Repin
Wednesday, February 3, 2021 18:25:18

Sorry for my terrible english...

More information about the Cygwin mailing list