Changes

Jump to navigation Jump to search

Multiple Python versions

860 bytes added, 18:50, 21 October 2020
m
</source>
This means that the script will look for Python in the PATH environmental variable (in Linux, Mac OS X, and MS Windows) and use that one rather than the Python version it was installed for. This is a fatal problem when multiple Python versions are present as the SCons files are installed as a site-package for the specific Python version, not for the default Python version on the PATH. There are two methods to overcome this difficulty, either by modifying the SCons source file or by pointing to the correct Python and SCons versions
=== Modifying the sources ===
The first is to edit the first line of this script to point to the correct Python version. For example if the Python you wish to use is installed in the /usr/local/bin/ directory, you could change this script to:<source lang="bash">
<source lang="bash">
#! /usr/local/bin/python
The last command forces '''/usr/local/bin/scons''' to use the correct Python version.
 
== Running relax ==
When multiple Python versions are present, there are two ways to run relax with the correct version, either by modifying the relax sources or by pointing to the correct Python version.
=== Modifying the sources ===
</source>
This will force the correct version. Note that if you are using MS Windows you will need to modify the '''relax.bat''' file instead, adding the full Python path to the '''python''' command in that batch file.
=== Pointing to the correct version ===
</source>
This assumes that relax is installed in the home directory. This can be added as an alias to the '''~/.bashrc''' file or equivalent:<source lang="bash">alias relax="/usr/local/bin/python ~/bin/relax"</source> For csh or tcsh, modify the '''~/.cshrc''' file as:<source lang="bash">alias relax /usr/local/bin/python ~/bin/relax</source>  = See also = [[Category:Python]]
Trusted, Bureaucrats
4,228

edits

Navigation menu