Getting gcloud to work in Cygwin Windows

4.6k views Asked by At

I am fairly new to programming. I have started app development on google app engine. I am trying to get the Google Cloud SDK to work with Cygwin 32 on Windows. I first ran the curl command to download the Google SDK files. Then I ran the install.py script and installed the SDK, however when calling gcloud in cygwin I receive this message:

Ammar Husain@Ammar-Computer:~
$ gcloud
/cygdrive/c/Users/Ammar Husain/google-cloud-sdk/bin/gcloud: line 102: C:\Python27: command not found

I have looked everywhere for a solution and have not been able to find one. I examined the gcloud file in the program files and it seems that there may be a problem with the Python Root Directory but I'm not sure. It may also be my Environment Variables.

Someone help?

3

There are 3 answers

3
Horst On BEST ANSWER

First: Cygwin 32? Do you have a 32bit machine? Otherwise the 64bit Version will be the better choice!

Please have a look here, if you DIDN'T install python via cygwin: Using python on windows

If you DID install it via cygwin: Set up python on windows

You might also have a look here: Set the pythonpath on cygwin

In all cases you have to add the python-directory to the PATH-Variable in Windows AND cygwin:

set PYTHONPATH=%PYTHONPATH%;C:\Path-to-python
echo "PATH=\$PATH:/cygdrive/c/Path-to-python" >> .bash_profile
2
Adam Manwaring On

I was having the same problem with Python not understanding the cygwin path. Instead of changing the gcloud script I created a C:/cygdrive folder. Then, I opened a windows command prompt and cded to the new folder. There, I ran mklink /D c C:\.

This created a link to the C: drive in such a way that Python understands /cygdrive/c/….

1
Stefano Giraldi On

After installing python 3.8 in my cygwin (with cygwin setup-x86_64.exe), I've used the versioned archive for Linux from

https://cloud.google.com/sdk/docs/downloads-versioned-archives

Then, I installed it in my cygwin home directory with this steps:

$ tar -xvf google-cloud-sdk-xxx.x.x-linux-x86_64.tar.gz
$ ./google-cloud-sdk/install.sh
$ source ~/.bashrc // 

It worked for me