1

I am trying to use Cygwin to run my first python program. I downloaded python and Cygwin. Within the Cygwin terminal I ran the command: "which python" to confirm that the terminal could find python. However when I attempt to cd into my Desktop for example, I get "-bash: cd: Desktop: No such file or directory". When I try to do an ls, it simply returns an empty line. For some reason "pwd" works normally.

I am having a problem similar to the one here: Cygwin ls command not found

However changing the environmental variables has no effect (even after I closed and repopened the terminal window).

Community
  • 1
  • 1
goodbyeworld
  • 11
  • 1
  • 3
  • basically the folder than contains ls command has to be in the Environment Variables. What happens when you manually search 'ls' command binary and add the parent folder to environmental variables? – user2707389 Oct 01 '15 at 03:45
  • 1
    It sounds like you're in an empty directory. What does `pwd` print, and what do you see when you look in that folder in the GUI? – Gordon Davisson Oct 01 '15 at 04:21
  • your Cygwin home directory is usually NOT the Windows user directory. `cygpath -w ~` should show something like `c:\cgwin64\home\your_user_name` – matzeri Jun 09 '20 at 13:27
  • About python, you need to install it: https://cygwin.com/faq.html#faq.setup.what-packages. As default only ~50 packages are installed, while 4000 package are eventually available – matzeri Jun 09 '20 at 13:29

1 Answers1

0

Make sure C:\cygwin64\bin or its equivalent is set as a path variable.

Run mintty.exe as administrator and enter: mkpasswd -l -p "$(cygpath -H)" > /etc/passwd

Close mintty.exe and access it again through the Windows shortcut 'Cygwin64 Terminal'. This is auto-generated during setup. The shortcut target should be set as the path to the bin which contains mintty.exe C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -.

Hope this helps!

Saif
  • 21
  • 2
  • this suggestion is usually obsolete. https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch – matzeri Jun 09 '20 at 13:31
  • Yes, this was the only workaround which seemed to work unfortunately. I am new to cygwin to so there is probably something I am missing in terms of domain knowledge. – Saif Jun 12 '20 at 07:04