Issues that could happen if importing site-packages from python2.6 to be used with python2.7?
Question: I finally managed to install numpy, but it seems to only work in python2.6 . I
don't know how to install it in the 2.7 folder (been trying for hours, but I'm
just a beginner developer in my first months). Anyway, if I use Python 2.7 and
append the absolute path to sys.path, could there be problems?

Any suggestions?

Thank you.


Answer: It could _partially_ work but this is a bad idea. **Just don't do it.** Even
if it seems to work, it may not. And if it really does, then it will fail
randomly in the future.

These are the potential problems that come into my mind:

  1. Extensions (those written in C, C++ etc.) are specific to a particular Python version; and numpy has a few extensions, AFAICS. It will work only if you don't use any of them (i.e. use pure Python modules);
  2. Python compiles modules into bytecode. The bytecode is specific to a particular Python version. If you use modules from python2.6 directory in python2.7, the compiled files will collide. I doubt this will cause major problems except for the fact that they will be recompiled every time Python version is switched;
  3. Python code can be version-specific. It's unlikely for minor versions (but for example Python 2/3 could have serious differences) but still can happen. In other words, the modules installed for Python2.6 can be actually a bit different than those for Python2.7;
  4. If you change the loading order, Python2.7 may start loading some standard modules from Python2.6. it could work, it could cause random breakages;
  5. It will make all modules installed for Python2.6 visible. It can cause a few random switches somewhere with unpredictable result. I doubt there's something specific for that version but some modules may actually decide to use some kind of deprecated interface finding it visible.

There could be more. You may actually try but be prepared that you may waste a
lot of time trying to find out why something does not work as expected later.

And unless I'm missing something, I think installing numpy for Python2.7
involves mostly running the setup _using_ Python 2.7; like:

    
    
    python2.7 setup.py clean
    python2.7 setup.py build
    python2.7 setup.py install
    

Depending on your particular install/system, it may be preferable to use the
package manager, binary bundle or a tool like `pip` instead. If you'd like
more details on how to enforce Python2.7 with those, you'd have to tell us
which one is of your choice.

