Upgrade python to 2.7.3 in cygwin

AppEngine is using Python 2.7, but the version of python installed with cygwin is 2.6. I have been trying to find how to install Python 2.7.3 on my machine, then I find this post

I installed successfully on my machine, and here is the step:

  1. download Python
  2. download the patch to the same directory.
  3. extract Python to current directory apply the patch
    $ bzcat Python-2.7.3-cygwin.patch.bz2 | patch -p0
    patching file Python-2.7.3/Include/py_curses.h
    patching file Python-2.7.3/Modules/_curses_panel.c
    patching file Python-2.7.3/Modules/_io/_iomodule.c
    patching file Python-2.7.3/Modules/_io/_iomodule.h
    patching file Python-2.7.3/configure
    
    
  4. Remove the soft link for the current version of python
    $ ls -l /usr/bin/python
    lrwxrwxrwx 1 CGuo mkgroup 22 Sep 17 17:33 /usr/bin/python -> /usr/bin/python2.6.exe
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ rm /usr/bin/python
    
  5. Run configure with /usr/local. I first tried with /usr/bin and it failed with permission issues.
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ ./configure --prefix=/usr/local
    checking for --enable-universalsdk... no
    checking for --with-universal-archs... 32-bit
    checking MACHDEP... cygwin
    checking EXTRAPLATDIR...
    checking machine type as reported by uname -m... i686
    checking for --without-gcc... no
    
    checking for resize_term... no
    checking for resizeterm... no
    checking for /dev/ptmx... yes
    checking for /dev/ptc... no
    checking for %lld and %llu printf() format support... yes
    checking for %zd printf() format support... yes
    checking for socklen_t... yes
    checking for build directories... done
    configure: creating ./config.status
    config.status: creating Makefile.pre
    config.status: creating Modules/Setup.config
    config.status: creating Misc/python.pc
    config.status: creating Modules/ld_so_aix
    config.status: creating pyconfig.h
    creating Modules/Setup
    creating Modules/Setup.local
    creating Makefile
    
  6. Make and install
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ make
    
    running build_scripts
    creating build/scripts-2.7
    copying and adjusting /cygdrive/c/Users/cguo/Downloads/Python-2.7.3/Tools/scripts/pydoc -> build/scripts-2.7
    copying and adjusting /cygdrive/c/Users/cguo/Downloads/Python-2.7.3/Tools/scripts/idle -> build/scripts-2.7
    copying and adjusting /cygdrive/c/Users/cguo/Downloads/Python-2.7.3/Tools/scripts/2to3 -> build/scripts-2.7
    copying and adjusting /cygdrive/c/Users/cguo/Downloads/Python-2.7.3/Lib/smtpd.py -> build/scripts-2.7
    changing mode of build/scripts-2.7/pydoc from 644 to 755
    changing mode of build/scripts-2.7/idle from 644 to 755
    changing mode of build/scripts-2.7/2to3 from 644 to 755
    changing mode of build/scripts-2.7/smtpd.py from 644 to 755
    /usr/bin/install -c -m 644 ./Tools/gdb/libpython.py python.exe-gdb.py
    
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ make install
    
    
    changing mode of /usr/local/lib/python2.7/lib-dynload/_random.dll to 755
    changing mode of /usr/local/lib/python2.7/lib-dynload/_socket.dll to 755
    changing mode of /usr/local/lib/python2.7/lib-dynload/_ssl.dll to 755
    changing mode of /usr/local/lib/python2.7/lib-dynload/_struct.dll to 755
    changing mode of /usr/local/lib/python2.7/lib-dynload/_testcapi.dll to 755
    changing mode of /usr/local/lib/python2.7/lib-dynload/ to 755
    running install_scripts
    copying build/scripts-2.7/2to3 -> /usr/local/bin
    copying build/scripts-2.7/idle -> /usr/local/bin
    copying build/scripts-2.7/pydoc -> /usr/local/bin
    copying build/scripts-2.7/smtpd.py -> /usr/local/bin
    changing mode of /usr/local/bin/2to3 to 755
    changing mode of /usr/local/bin/idle to 755
    changing mode of /usr/local/bin/pydoc to 755
    changing mode of /usr/local/bin/smtpd.py to 755
    running install_egg_info
    Writing /usr/local/lib/python2.7/lib-dynload/Python-2.7.3-py2.7.egg-info
    if test -f /usr/local/bin/python.exe -o -h /usr/local/bin/python.exe; \
    then rm -f /usr/local/bin/python.exe; \
    else true; \
    fi
    (cd /usr/local/bin; ln -s -s python2.exe python.exe)
    rm -f /usr/local/bin/python2.exe
    (cd /usr/local/bin; ln -s -s python2.7.exe python2.exe)
    rm -f /usr/local/bin/python2-config
    (cd /usr/local/bin; ln -s -s python2.7-config python2-config)
    rm -f /usr/local/bin/python-config
    (cd /usr/local/bin; ln -s -s python2-config python-config)
    test -d /usr/local/lib/pkgconfig || /usr/bin/install -c -d -m 755 /usr/local/lib/pkgconfig
    rm -f /usr/local/lib/pkgconfig/python2.pc
    (cd /usr/local/lib/pkgconfig; ln -s -s python-2.7.pc python2.pc)
    rm -f /usr/local/lib/pkgconfig/python.pc
    (cd /usr/local/lib/pkgconfig; ln -s -s python2.pc python.pc)
    Creating directory /usr/local/share/man
    Creating directory /usr/local/share/man/man1
    /usr/bin/install -c -m 644 ./Misc/python.man \
            /usr/local/share/man/man1/python2.7.1
    
    
  7. Celebrate!
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ which python
    /usr/local/bin/python
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ python --version
    Python 2.7.3
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ ls -l /usr/local/bin
    total 5344
    -rwxr-xr-x 1 CGuo mkgroup     103 Sep 19 15:40 2to3
    -rwxr-xr-x 1 CGuo mkgroup     101 Sep 19 15:40 idle
    -r-xr-xr-x 1 CGuo mkgroup 5382079 Sep 19 16:18 libpython2.7.dll
    -rwxr-xr-x 1 CGuo mkgroup      86 Sep 19 15:40 pydoc
    lrwxrwxrwx 1 CGuo mkgroup      11 Sep 19 16:21 python.exe -> python2.exe
    -rwxr-xr-x 1 CGuo mkgroup   50679 Sep 19 16:18 python2.7.exe
    -rwxr-xr-x 1 CGuo mkgroup    1628 Sep 19 16:21 python2.7-config
    lrwxrwxrwx 1 CGuo mkgroup      13 Sep 19 16:21 python2.exe -> python2.7.exe
    lrwxrwxrwx 1 CGuo mkgroup      16 Sep 19 16:21 python2-config -> python2.7-config
    lrwxrwxrwx 1 CGuo mkgroup      14 Sep 19 16:21 python-config -> python2-config
    -rwxr-xr-x 1 CGuo mkgroup   18549 Sep 19 15:40 smtpd.py
    
    

    Comments

    blog comments powered by Disqus