geoslegend / netcdf4-python

Automatically exported from code.google.com/p/netcdf4-python
Other
0 stars 0 forks source link

Installing with multiple versions of Python #131

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
For multiple reasons, the Linux system I am working on has Python2.4 and 
Python2.6 installed.

Python2.4 is the 'default' Python executed with the command 'python'.

I don't have root access. I installed netCDF4 in a separate packages folder. 
However, it did this for Python2.4, and if I run Python2.6 and try to import 
the library I get a ‘undefined symbol: Py_InitModule4’ error.

I don't see any ways to tell the setup what version of Python to install. Does 
it just use the Python.h header file to determine this? Some other way?

Is there a way I can generate the Python2.6 libraries?

Thanks,
Mike

Original issue reported on code.google.com by mpjoh...@jpl.nasa.gov on 18 Jul 2012 at 7:44

GoogleCodeExporter commented 8 years ago
Nevermind, I got it working.

Thanks.

Original comment by mpjoh...@jpl.nasa.gov on 18 Jul 2012 at 7:45

GoogleCodeExporter commented 8 years ago
This is not a netcdf4-python issue.  You can't import C extensions built with 
python2.4 with python2.6.  

If you run python setup.py install --user with python2.6, it will create a 
separate (python-versioned) install directory in your home directory.  I 
believe you don't need to set PYTHONPATH, since that directory is automatically 
searched.

This won't work for python2.4 however, so you'll have to specify the directory 
to install in (or use --home) and then set the PYTHONPATH to look in this 
directory when you're using python2.4.  Be careful to unset the PYTHONPATH when 
you use python2.6 however.

Or, just use virtualenv (http://pypi.python.org/pypi/virtualenv/) which is 
designed specifically to deal with this sort of thing.

Original comment by whitaker.jeffrey@gmail.com on 18 Jul 2012 at 7:48

GoogleCodeExporter commented 8 years ago

Original comment by whitaker.jeffrey@gmail.com on 26 Feb 2014 at 2:04

GoogleCodeExporter commented 8 years ago

Original comment by whitaker.jeffrey@gmail.com on 26 Feb 2014 at 2:04