Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>1) Invoking python 2.7</h2> <p>In short: don't do this. There are reasons why the path is called '/usr/lib/python*<em>2.6</em>*/site-packages/'.</p> <p>One reason is, that in this directory typically the 'compiled' python files (.pyc) are stored. python 2.6 and python 2.7 .pyc files are not compatible:</p> <pre><code>$ python2.7 /usr/lib/python2.6/sitecustomize.pyc RuntimeError: Bad magic number in .pyc file </code></pre> <p>python will skip pyc files which it cannot understood, but you loose at least the benefits of precompiled files.</p> <p>Another reason is, that things might get mixed up:</p> <pre><code>$ strace -f python2.7 /usr/lib/python2.6/sitecustomize.py ... stat("/etc/python2.6", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/etc/python2.6", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/etc/python2.6/apport_python_hook", 0x7fffa15601f0) = -1 ENOENT (No such file or directory) open("/etc/python2.6/apport_python_hook.so", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/python2.6/apport_python_hookmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/python2.6/apport_python_hook.py", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/python2.6/apport_python_hook.pyc", O_RDONLY) = -1 ENOENT (No such file or directory) stat("/usr/lib/python2.7/apport_python_hook", 0x7fffa15601f0) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/apport_python_hook.so", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/apport_python_hookmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/apport_python_hook.py", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/apport_python_hook.pyc", O_RDONLY) = -1 ENOENT (No such file or directory) stat("/usr/lib/python2.7/plat-linux2/apport_python_hook", 0x7fffa15601f0) = -1 ENOENT (No such file or directory) ... </code></pre> <p>I would in your case install the modules needed also for python 2.7 in the python2.7 directory.</p> <h2>2) Invoking python 2.6</h2> <p>You might want to have a look at the part of the man page where PYTHONHOME is described:</p> <blockquote> <p>PYTHONHOME: Change the location of the standard Python libraries. By default, the libraries are searched in ${prefix}/lib/python[version] and ${exec_prefix}/lib/python[version], where ${prefix} and ${exec_prefix} are installation-dependent directories, both defaulting to /usr/local</p> </blockquote> <p>You can store the python 2.7 specific files / modules in the appropriate directory in your local installation. Those files / modules will only be picked up when you run the specific version of python. In this case you must not set the PYTHONPATH (or PYTHONHOME).</p> <p>Note: this is exactly the way Debian (and maybe other distributions) manage different simultaneously installed versions of python.</p> <p>[Edit: Added section 1 after receiving a comment from niboshi.]</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload