Friday, January 14, 2011

Best way to have full Python install under cygwin/XP?

Pythons installed under WinXP have dirs like DLLs, DOC, include, etc. but python (2.5) installed with cygwin is a bare python.exe. My motivation for asking is that 'things' under XP don't seem to be finding 'other things' under cygwin and vice versa, I want to start developing with Qt, I like shells, and I do not like MS; I thought if I got all the components under one roof, I could finally start to have scripts find executables which could find files and such. 1. Can I simply copy the contents of an XP installation into the cygwin tree? 2. Is the XP flavor of Python different from the cygwin flavor? (Same CPU, he pointed out, naively.) 3. Someone must work with a full-fledged (if snakes had feathers...) Python from within cygwin; how is it done?

Disclaimer 1: I have never compiled anything under XP or cygwin; had hoped not to have to go there, hence, python in the first place. Disclaimer 2: Asked this over at StackOverflow but got a strong hint to ask it here, so here I am.

Responding to this comment: Can you be more specific about "things" finding "other things"? Error messages, for example. Also, what method did you use to install Python under Cygwin? And have you considered installing Linux in a virtual machine with XP as the host? – Dennis Williamson

Error msgs: I expect that it all can be traced to the settings of environment variables like $PATH. When I write a Python script that opens files named on the command line, I have gotten errors saying "file not found"; this goes away if I copy the script into the working dir. I may be on the way to curing this by using os.path.abspath() to introduce the full, ugly filename into the script. Another form of "not finding" I have seen is cygwin not locating the Python installation I wish to use, whether one of the Pythons installed on C: (my system partition) or in cygwin's /usr/bin, which is also /cygdrive/d/cygwin/usr/bin (where D:, aka /cygdrive/d is my user partition). I can't cite the error exactly: didn't write the errmsg down, foolishly.

Method of installing Python under cygwin: Updated the cygwin distribution by using their install; selected their version of Python (happens to be a 2.5) when the opportunity arose.

WinXP --> VM, e.g. Virtual Box from Sun --> a Linux --> full Python installation (all the subdirs, etc.): These are new to me and am just reading up on them. Big question I have is whether the host and virtual OSes share access to certain (all?) filesystems. Having a Linux sandbox bounded by impenetrable walls does not sound terribly useful.

  • Copying your Python install into Cygwin won't work.

    Python Extensions for Windows seems to be what you are after.

    Otherwise, I would look at ActivePython (www.activestate.com/activepython/)* if you want to stay on Windows.

    *Sorry, it will only let me put 1 link...

    : Actually, I want to work with Python under cygwin. WinXP is just a fact of life in the background that holds the Python distribution, along with a _lot_ of other things. Linux, as far as I've been able to judge it, is out, for me.
    From
  • Check out IronPython. Even if you don't like MS, you gotta love the way it hooks into .Net libraries but still gives you access to the standard python library. IronPython in Action is a great way to get started with IPY...lots of good examples including desktop scripting.

    : I don't understand. I do most of my work inside cygwin. I'm trying to find the best way to operate a full-blown Python distribution from there. I don't even know why I would want .Net libraries. I'm trying to write books, sling text around, and solve puzzles for mental exercise, and I _like_ my cygwin environment --- considering the alternative.
    Adam Brand : I guess it depends on what you are doing. If you need to interact with the Windows environment in any way (create a scheduled task, grab something from the Internet, etc.), you will find that the .Net libraries IPY makes available are very useful.
    From Adam Brand
  • For ease of use, I think the combination of Ubuntu and VirtualBox will be a good fit for you for your first foray into virtualization.

    This seems to be a decent tutorial on installing those under Windows XP. Here's a video tutorial for installing the Guest Additions once you get Ubuntu running.

    Package management is even easier under Ubuntu than Cygwin. You can select Add/Remove... from the Applications menu, then enter "python" in the search box, click the check box next to the version you want, then click the Apply Changes button to install. You can also use the Synaptic Package Manager in the System>Administration menu for more detailed package management. Or you can install packages from the command line in a terminal using apt-get (start a terminal by selecting Terminal from the Applications>Accessories menu).

    sudo apt-get install python2.6
    

    In addition to some of the capabilities I mentioned in a comment above, you'll be able to mount devices under the guest OS such as the host's physical CD/DVD drive (in addition to mounting ISO images), USB drives and memory sticks. You'll also have access to the host's network connection and will be able to browse the internet using Firefox (which is installed by default) or another browser that you might install.

    I don't believe it's possible to run a VM under another VM.

0 comments:

Post a Comment