0

I am going through some programing related tutorials that require usage of use bash on Windows. I installed CYGWIN, but it seems linux uses a environmental variable called PYTHONPATH, which the default installation of Python on Windows doesnt have.

I attempted to add this environmental variable in Windows by creating a system variable as such:

Variable name: PYTHONPATH

Variable Value: C:\Users\Moondra\AppData\Local\Programs\Python\Python36\Scripts;C:\Python27\;C:\Python27\Scripts;

Now if I run this (below) on CYGWIN, I get the following ("command not found"):

$ $PYTHONPATH

bash:C:\Users\Moondra\AppData\Local\Programs\Python\Python36\Scripts;C:\Python27\;C:\Python27\Scripts;: command not found

It seems to be printing out the paths, but I am also getting a command not found error. I don't know how to resolve this issue.

Thank you.

1 Answer 1

2

if you want to see the value of the PYTHONPATH environment variable in Cygwin bash

$ echo "PYTHONPATH=$PYTHONPATH"

or

$ set | egrep '^PYTHONPATH='

If you just type "dollar-variablename" as you have done bash will try to expand the contents of the variable and then run it as a command (script or executable file) - since it is really a list of directories it fails with the "command not found" message.

If you really want to run python from the Cygwin bash command line try something like this:

$ find "$(cygpath 'C:\' )" -mount -maxdepth 3 -iname python.exe -print 2>/dev/null
/cygdrive/c/Python27/python.exe
/cygdrive/c/Python37/python.exe
$ mkdir -p /usr/local/python/cygdrive-c-python27/bin
$ ln -s /cygdrive/c/Python27/python.exe /usr/local/python/cygdrive-c-python27/bin/python
$ export PATH="/usr/local/python/cygdrive-c-python27/bin:$PATH"
$ type python
python is /usr/local/python/cygdrive-c-python27/bin/python
$ python --version
Python 2.7.12

Search on google or bing or dogpile for "bash basics" or "linux command line basics" for more information about bash

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .