Getting Python to work on Cygwin

8,886

Solution 1

Here is how I got Python working for me in Windows 10 x64 under Cygwin x64, actually quite simple:

$> which python /usr/bin/python $> which python3 /usr/bin/python3

I installed the versions of Python (2.7 and 3.6) via Cygwin. It seems to me you try to get the native Windows version Python running, which can be difficult if you are going to use it from a Cygwin terminal.

Solution 2

I am not familiar with Cygwin, but had the same problem.

I solved it in my case by removing Cygwin from the PATH (Windows environment) variable, but it should be enough to place the path to Cygwin after the path to your Python installation.

Share:
8,886

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I installed cygwin and python but for some reason I can't get python to work.

    when I type type python it gives me:

    python is /cygdrive/c/Users/pnwar/AppData/Local/Programs/Python/Python36/python
    

    however my python path should be:

    C:\Users\pnwar\AppData\Roaming\Microsoft\Windows\'Start Menu'\Programs\'Python 3.6'
    

    I tried messing with the PATH, echo $PATH gives:

    /usr/local/bin:/usr/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Program Files (x86)/Razer Chroma SDK/bin:/cygdrive/c/Program Files/Razer Chroma SDK/bin:/cygdrive/c/Program Files (x86)/Intel/iCLS Client:/cygdrive/c/Program Files/Intel/iCLS Client:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Users/Administrator/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files (x86)/Skype/Phone:/usr/bin:/cygdrive/c/Program Files (x86)/PuTTY:/cygdrive/c/Users/pnwar/AppData/Local/Programs/Python/Python36/Scripts:/cygdrive/c/Users/pnwar/AppData/Local/Programs/Python/Python36:/cygdrive/c/Users/pnwar/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/pnwar/AppData/Roaming/Microsoft/Windows/Sta rt Menu/Programs/Python 3.6:/cygdrive/c/Users/pnwar/AppData/Roaming/Microsoft/Windows/Sta rt Menu/Programs/Python 3.6
    

    Towards the end you can see some erroneous paths that I can't seem to edit correctly to get things to work.

    I tried PATH=echo $PATH | sed -e 's/:\/cygdrive/c/Users/pnwar/AppData/Local/Programs/Python/Python36\/$//'

    because I found it somewhere but that just erased all of my paths.

    I added the correct path to my .bash_profile with PATH=\$PATH:/cygdrive/c/Users/pnwar/AppData/Roaming/Microsoft/Windows/'Start Menu'/Programs/'Python 3.6' But I still can't seem to get it to work.

    If anyone could push me in the right direction that would be much appreciated, I'm kind of confused as to what is going on exactly and how to get it to work.

    • Admin
      Admin about 7 years
      1/ Don't mix cygwin and Windows path elements unless you know what you are doing 2/ What's wrong with installing the cywin version of python?
  • terary
    terary over 5 years
    I have years experience using cygwin, none using python.. However, for best results always use cygwin's native version of whatever [perl, apache, git, etc]. Always use cygwins binaries and paths (whereis <-- is your friend). Window's does too much user coddelling in regard to binary installs and file name to be useful to a power user, such as you are if you're reading this.