[wingide-users] Python versions, paths, envt; IDE vs command line

Wingware Support support at wingware.com
Thu Sep 5 09:33:05 EDT 2013


Graham Wideman wrote:
> I think my brain has finally exploded trying to work with multi versions of Python, let's say 2.7.x, 3.3.x, and Anaconda (2.7.x, with a bunch of libraries).
>
> I sorely need a concise doc that lays out how to do this right with minimal fumbling.
>
> What paths, batch-files/scripts and configuration files etc do I need to put in place to switch smoothly between these projects, both on the command line, and in WingIDE?  It seems to me such a scheme needs to attend to:
>
> -- "Permanent" OS PATH and other environment variables -- This should not require ad hoc changing. I suspect this should be minimal, maybe just enough to find...
>
> -- Scripts to invoke shell with PATH set for particular installation of Python?
>
> -- ... but with variants for environment variables that prepare for different sys.path for different projects? (Or for that matter, to launch the specific python scripts in question?)
>
> -- ... and how to coordinate all that with WingIDE, so that (a) WingIDE sees the Python installation it needs internally, and (b) so that for a specific project it finds the right source files for code navigation and completion and (c) so it configures the right environment for debugging...
>
> -- And have the configuration for a project managed in one place, respected by both the command line and WingIDE.
>
> I need to know how to do this on Windows and on Linux. (Separately -- I'm not trying to make a project hosted on Linux also run or work in the IDE via file sharing on Windows, or vice versa. Though that would be useful too.)
>
> I am hoping there's a nice doc out there somewhere that spells all this out! Thanks!

I think you're probably looking for virtualenv: 
https://pypi.python.org/pypi/virtualenv

This is also included in Python 3.3 (possibly w/ some differences; I am 
not sure):  http://docs.python.org/dev/library/venv.html

In Wing you just point the Python Executable in Project Properties at 
the Python that virtualenv creates.

That's the easy/modern way.  In Wing you can also set up Python 
Executable, Python Path, Environment, etc in the Project Properties 
which lets you do this manually, but you do need to set up 
well-separated Python installations or at least know what you're doing 
with respect to your changes to Python Path, etc.  Since I've been doing 
this since Python 1.5 I still sometimes do this by building Python from 
sources with the --prefix option to configure to set the install 
destination.  Then I just make sure I run that Python when 
building/installing other modules from source.  It's something like this:

cd /path/to/unpacked/python-source
./configure --prefix=/path/to/install
make
make install

And for installing other packages from sources:

cd /path/to/unpacked-package
/path/to/install/bin/python setup.py install

This can be useful if you want to work with a bleeding edge checkout 
from a revision control system, although note that you should also be 
able to install packages in the same way into a virtualenv.

Both of these are pretty much the same on Windows and Linux.

Hope this is useful as a starting point.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com


More information about the wingide-users mailing list