1. Install Python
Because scons is written in Python, you must install Python before using scons. Before installing python, check whether python is available in your system (run Python-V or Python-version in the command line of the system ). $ Python-vpython 2.5.1 In a Windows system, c: \> Python-vpython 2.5.1 if python is not installed, you will see an error message such as "command not found" (in Unix or Linux) or "python is not recognized as an internal or external command, operable program or batch file "(in Windows ). In this case, you need to install Python before installing scons. You can download and install python from http://www.python.org/download.
2. Install scons from the pre-compiled package
2.1 install scons in Red Hat (or rpm-based) LinuxIn Red Hat Linux, fedora, or any other Linux distributions using RPM (Red Hat Package Manager), scons is a pre-compiled RPM format and is ready for installation. Your release may already contain a pre-compiled scons rpm. If your release supports Yum installation, run the following command to install scons: # Yum install scons. If your Linux release does not contain a specific scons RPM file, you can download the General RPM provided by the scons project for installation. This will install the scons script to the/usr/bin directory, and install the scons library module (library modules) to/usr/lib/scons. Install from the command line, download the appropriate. RPM file, and then run: # rpm-uvh scons-2.1.0-1.noarch.rpm
2.2 install scons In Debian LinuxIf your system is connected to the Internet, run the following command to install the latest official Debian package: # apt-Get install scons
2.3 install scons in WindowsScons provides a Windows Installer that makes installation very easy. Download scons-2.1.0.win32.exefrom http://www.scons.org/download.php. Then you need to execute this file.
3. Compile and install scons in any systemIf your system does not have a pre-compiled scons package, you can use the local Python distutils package to easily compile and install scons. Step 1 download scons-2.1.0.tar.gzor scons-2.1.0.zip at http://www.scons.org/download.html. Unzip the downloaded file, will create a directory named scons-2.1.0, enter this directory and execute the following command to install scons: # cd scons-2.1.0 # Python setup. PY install this will compile scons and install the scons script to the python directory (/usr/local/bin or c: \ python25 \ scripts ), the scons compilation engine is installed in the library directory used by Python (/usr/local/lib/scons or c: \ python25 \ scons ). Because these are System directories, you may need root or administrator permissions to install scons.
3.1. Compile and install scons for multiple versionsThe setup. py script of scons has some extensions that support installing multiple versions of scons to different locations. This makes it easy to download and experience scons of different versions. Install scons to the specified version and call setup. added the -- version-lib option when using Py: # Python setup. PY install -- version-lib this will install the scons compilation engine to the/usr/lib/scons-2.1.0 or c: \ python25 \ scons-2.1.0 directory.
3.2 install scons to other locationsYou can install scons to another location, instead of the default location. Specify -- prefix = option: # Python setup. PY install -- prefix =/opt/scons this will install the scons script to/opt/scons/bin, install the compilation engine to/opt/scons/lib/scons. You can specify -- prefix and -- version-lib at the same time. PY will install the compilation engine to the directory of a specific version relative to the specified prefix, and add -- version-Lib in the preceding example, the compilation engine will be installed to/opt/scons/lib/scons-2.1.0.
3.3. Compile and install scons without administrator permissionsIf you do not have the permission to install scons to the system directory, use the -- prefix option to install scons to another location of your choice. For example, to install scons to a proper location relative to the user's $ home directory, install the scons script to $ home/bin, and install the compilation engine to $ home/lib/scons. Run the following command: # Python setup. PY install -- prefix = $ home