|
1 | 1 | Properly Installing Python |
2 | 2 | ========================== |
3 | 3 |
|
4 | | - |
5 | | -Windows |
6 | | -::::::: |
7 | | - |
8 | | - |
9 | | - |
10 | | -Prerequisites: |
11 | | --------------- |
12 | | - |
13 | | -* Python2.7 (x86) from Python.org |
14 | | -* Microsoft Visual Studio |
15 | | - |
16 | | - |
17 | | -Step 1: Set PATH variables |
18 | | --------------------------- |
19 | | -If you haven't set your PATH variables as part of the Python2.7 install, now is the time to do that. Right click on My Computer and select properties. |
20 | | - |
21 | | -* Click Advanced System Settings from left hand list (Advanced Tab on Windows XP) |
22 | | -* Click Advanced System Settings from left hand list (On Windows XP click the Advanced Tab) |
23 | | -* Click the Environment Variables button at the bottom |
24 | | -* In the System variables section double click on the variable line named Path |
25 | | -* Scroll to the end of the variable value field |
26 | | -* add semicolon (;) if one doesn't exist and then type ``C:\Python27\;C:\Python27\Scripts\`` |
27 | | - |
28 | | -Step 2: Install Distribute & Pip |
29 | | --------------------------------- |
30 | | - |
31 | | -**Distribute** is a fantastic drop-in replacement for **easy_install** and **setuptools**. It allows you to install and manage python packages from PyPi, amongst a few other sources. |
32 | | - |
33 | | -To install it, run the python script available here: |
34 | | - <http://python-distribute.org/distribute_setup.py> |
35 | | - |
36 | | -**easy_install** is considered by many to be a deprecated system, so we will install it's replacement: **pip**. Pip allows for uninstallation of packages, and is actively maintained, unlike setuptool's easy_install. |
37 | | - |
38 | | -To install pip, simply open a command prompt and run: :: |
39 | | - |
40 | | - > easy_install pip |
41 | | - |
42 | | - |
43 | | -Linux (Ubuntu) |
44 | | -:::::::::::::: |
45 | | - |
46 | | -Oneiric Ocelot, the latest version of Ubuntu, **comes with Python 2.7 out of the box**. Python 3.2 can be installed and run with the following commands:: |
47 | | - |
48 | | - $ sudo apt-get install python3-minimal |
49 | | - $ python3 |
50 | | - |
51 | | -Older versions of Python aren't available from the official repository. However, if it's needed (for example to support legacy code), we can add an unsupported repository and install an older version of Python (2.5 in the example below):: |
52 | | - |
53 | | - $ sudo apt-get install python-software-properties |
54 | | - $ sudo add-apt-repository ppa:fkrull/deadsnakes |
55 | | - $ sudo apt-get update |
56 | | - $ sudo apt-get install python2.5 |
57 | | - |
58 | | -Installing setuptools and pip |
59 | | ------------------------------ |
60 | | - |
61 | | -While Python has an extensive standard library, the set of packages available from the Internet is even more extensive. In order to install them easily, we'll install the ``distribute`` package and then ``pip``:: |
62 | | - |
63 | | - $ wget http://python-distribute.org/distribute_setup.py |
64 | | - $ sudo python distribute_setup.py |
65 | | - $ sudo easy_install pip |
66 | | - |
67 | | -Now, most Python packages can be installed using the ``pip`` command. For example, if we wanted to install Django:: |
68 | | - |
69 | | - $ sudo pip install django |
70 | | - |
71 | | -A full list of ``pip``'s capabilities is available by typing ``pip --help``. |
72 | | - |
73 | | -Linux (Manual) |
74 | | --------------- |
75 | | - |
76 | | -While your system will quite likely already have Python installation, you might wish to install a different version. This is done in the typical Linux software source install procedure:: |
77 | | - |
78 | | - $ wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz |
79 | | - $ tar -xvf Python-2.7.2.tgz |
80 | | - $ cd Python-2.7.2 |
81 | | - $ ./configure |
82 | | - $ make |
83 | | - $ make install |
84 | | - |
85 | | - |
| 4 | +- :ref:`Mac OS X <install-osx>`. |
| 5 | +- :ref:`Microsoft Windows<install-windows>`. |
| 6 | +- :ref:`Ubuntu Linux <install-linux>`. |
86 | 7 |
|
0 commit comments