views:

2918

answers:

3

The Question

What is the correct way to install Python 3.0 alongside Python 2.x using Cygwin?

Notes

I already have a working copy of Cygwin, and Python 2.x is installed within Cygwin (/lib/python2.x, not c:\python2.x).

Also, I would like to be able to call python 3 separately (and only intentionally) by leaving python pointing to Python 2.x to preserve existing dependencies. I would like to use python30 or some alternative.

Any pointers to guides on the subject would be much appreciated. I cannot seem to find one either at the cygwin site or python.org.

+4  A: 

The standard make install target of the Python 3.0 sources doesn't install a python binary. Instead, make install prints at the end

* Note: not installed as 'python'.
* Use 'make fullinstall' to install as 'python'.
* However, 'make fullinstall' is discouraged,
* as it will clobber your Python 2.x installation.

So don't worry.

If you easily want to remove the entire installation, do something like configure --prefix=/usr/local/py3

Martin v. Löwis
+1  A: 

Over in the Perl world, I always install my own, with a prefix:

./configure --prefix=/usr/local/perl/5.10.0

I never want to deal with whatever perl came with my OS, as I don't want to install libraries for it and potentially mess up scripts that were written in the OS.

I do the same thing for Cygwin, as it's much nicer for me to be able to install my own modules and not worry that Cygwin update will trash them.

If and when I learn Python (I'd like to), I intend to do the same thing.

This way I can upgrade individual applications from one version to another independently.

For really serious applications (like a major web app), I might even do a self-contained installation owned by a user dedicated to the app.

skiphoppy
A: 

To use Python 3 in a non-intrusive manner, if you don't have one already, create a file called ".bash_profile" in your user home directory.

Set up an alias pointing at your Python 3 install. On my Windows machine this looks like so:

alias python3=/cygdrive/d/apps/Python31/python
export python3

Adjust the path according to where your install is located, and if on Windows, be careful to ensure you're using UNIX line breaks or you will get a message such as "bash: $'\r': command not found".

You should now be able to use the "python3" command, and you haven't modified the version of Python that came with Cygwin.

Steve