04.08.2014 Views

o_18ufhmfmq19t513t3lgmn5l1qa8a.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4 CHAPTER 1 ■ INSTANT HACKING: THE BASICS<br />

If there is no Python interpreter installed, you will probably get an error message similar to<br />

the following:<br />

bash: python: command not found<br />

In that case, you have to install Python yourself, as described in the following sections.<br />

Linux with RPM<br />

If you are running a Linux distribution with the RPM package manager installed, follow these<br />

steps to install the Python RPM packages:<br />

1. Go to the download page (refer to steps 1 and 2 in the instructions for installing Python<br />

on a Windows system).<br />

2. Follow the link with the most recent version number, such as “Python 2.4.” (Don’t<br />

choose a link with the word “sources” in it.) Chances are that this link will be found early<br />

on the page. For Python 2.4, you could simply go to the URL http://www.python.org/<br />

2.4. Follow the instructions for Fedora users: follow the link “RPMs.”<br />

3. Download all the binary RPMs. Store them in a temporary location (such as ~/rpms/<br />

python).<br />

4. Make sure you are logged in as system administrator (root) and are currently in the<br />

directory where you stored the RPMs. Make sure there are no other RPMs in this<br />

directory.<br />

5. Install the packages by executing the command rpm --install *.rpm. If you already<br />

have an older version of Python installed and wish to upgrade, you should instead use<br />

rpm --upgrade *.rpm.<br />

■Caution The preceding command installs all the RPM files in the current directory. Make sure that you<br />

are in the correct directory and that it only contains the packages you want to install. If you want to be more<br />

careful, you can specify the name of each package separately. For more information about RPMs, check out<br />

the man page.<br />

You should now be able to run Python. On occasion, you may run into some unresolved<br />

dependencies—you may lack other RPM packages needed to install Python. To locate these<br />

packages, visit a search facility such as http://www.rpmfind.net.<br />

Sometimes a binary RPM package designed for one Linux distribution (for example, Red<br />

Hat Linux) may not work smoothly with another (for example, Mandrake Linux). If you find<br />

that the binary package is giving you grief, try downloading a source RPM instead (with a name<br />

like packagename.src.rpm). You can then build a set of binary packages tailored for your system<br />

with the command<br />

rpm --rebuild packagename.src.rpm

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!