12.07.2015 Views

Is Python a

Is Python a

Is Python a

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The <strong>Python</strong> 2.5 MSI Installer on Windows VistaAs I write this in mid-2007, the <strong>Python</strong> self-installer for Windows is a .msi installationfile. This format works fine on Windows XP (simply double-click on the file, and itruns), but it can have issues on the current version of Windows Vista. In particular,running the MSI installer by clicking on it caused <strong>Python</strong> to be installed at the root ofthe C: drive on my machine, instead of in the correct C:\<strong>Python</strong>25 directory. <strong>Python</strong>still works in the root directory, but this is not the correct place to install it.This is a Vista security-related issue; in short, MSI files are not true executables, so theydo not correctly inherit administrator permissions, even if run by the administratoruser. Instead, MSI files are run via the Widows Registry—their filenames are associatedwith the MSI installer program.To install <strong>Python</strong> 2.5.1 on my Vista-based OQO handheld, I had to use a commandlineapproach to force the required administrator permissions. Here’s the workaround:go to your Start button, select the All Programs entry, choose Accessories, right-clickon the Command Prompt entry there, choose “Run as administrator,” and select Continuein the access control dialog. Now, within the Command Prompt window, issuea cd command to change to the directory where your <strong>Python</strong> MSI installer file resides(e.g., cd C:\user\downloads), and then run the MSI installer manually by typing acommand line of the form msiexec /i python-2.5.1.msi. Finally, follow the usual GUIinteractions to complete the install.Naturally, this behavior may change over time. This procedure may not be required infuture versions of Vista, and additional workarounds may be possible (such as disablingVista security, if you dare). It’s also possible that the <strong>Python</strong> self-installer mayeventually be provided in a different format that fixes this problem in the future—as atrue executable, for instance. Be sure to try your installer by simply clicking its iconbefore attempting any workarounds to see if it works properly.<strong>Python</strong> Environment VariablesEnvironment variables—known to some as shell variables, or DOS variables—liveoutside <strong>Python</strong>, and thus can be used to customize the interpreter’s behavior eachtime it is run on a given computer. <strong>Python</strong> recognizes a handful of environment variablesettings, but only a few are used often enough to warrant explanation here.Table A-1 summarizes the main <strong>Python</strong>-related environment variable settings.Table A-1. Important environment variablesVariablePATH (or path)PYTHONPATHPYTHONSTARTUPTCL_LIBRARY, TK_LIBRARYRoleSystem shell search path (for finding “python”)<strong>Python</strong> module search path (for imports)Path to <strong>Python</strong> interactive startup fileGUI extension variables (Tkinter)642 | Appendix A: Installation and Configuration

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

Saved successfully!

Ooh no, something went wrong!