Skip to content

Commit 6135e2b

Browse files
committed
Fixes #589 Better documentation for Linux installation
1 parent 3f2f8bd commit 6135e2b

1 file changed

Lines changed: 73 additions & 9 deletions

File tree

docs/starting/install/linux.rst

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,31 @@
33
Installing Python on Linux
44
==========================
55

6+
-------------------------------------------------------------------------------------------------
7+
If you want to check which Python version you have already installed fire up a terminal and type:
8+
.. code-block:: console
9+
10+
$ python --version
11+
12+
Or you can type:
13+
14+
.. code-block:: console
15+
16+
$ python
17+
18+
and you should get something similar to:
19+
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
20+
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
21+
Type “help”, “copyright”, “credits” or “license” for more information.
22+
23+
If you want to exit simply type:
24+
25+
.. code-block:: console
26+
27+
>>> quit()
28+
29+
-------------------------------------------------------------------------------------------------
30+
631
The latest versions of Ubuntu and Fedora **come with Python 2.7 out of the box**.
732

833
The latest versions of Redhat Enterprise (RHEL) and CentOS come with Python 2.6.
@@ -21,9 +46,27 @@ described in the next section before you start building Python applications
2146
for real-world use. In particular, you should always install Setuptools, as
2247
it makes it much easier for you to use other third-party Python libraries.
2348

49+
50+
Distutils
51+
---------
52+
Distutils is still the standard tool for packaging in Python.
53+
It's included in the standard library (Python 2 and Python 3.0 to 3.3).
54+
It's useful for simple Python distributions, but lacks features.
55+
It introduces the distutils Python package that can be imported in your setup.py script.
56+
57+
58+
Setuptools
59+
----------
60+
Was developed to overcome Distutils' limitations, and is not included in the standard library.
61+
It introduced a command-line utility called easy_install.
62+
It also introduced the setuptools Python package that can be imported in your setup.py script, and the pkg_resources
63+
Python package that can be imported in your code to locate data files installed with a distribution.
64+
One of its gotchas is that it monkey-patches the distutils Python package.
65+
It should work well with pip. The latest version was released in July 2013.
66+
67+
2468
Setuptools & Pip
2569
----------------
26-
2770
The most crucial third-party Python software of all is Setuptools, which
2871
extends the packaging and installation facilities provided by the distutils
2972
in the standard library. Once you add Setuptools to your Python system you can
@@ -38,25 +81,47 @@ The new ``easy_install`` command you have available is considered by many to be
3881
deprecated, so we will install its replacement: **pip**. Pip allows for
3982
uninstallation of packages, and is actively maintained, unlike easy_install.
4083

41-
To install pip, simply open a command prompt and run
84+
To install pip FOR ALL USERS, simply open a command prompt and use the appropriate command according your Linux distro:
4285

43-
.. code-block:: console
86+
For RHEL / CentOS / Fedora Linux installation:
87+
----------------------------------------------
88+
89+
.. code-block:: console
90+
91+
# yum -y install python-pip
92+
93+
After completed add an alias to it on your ~./bashrc :
94+
95+
$ echo 'alias pip="/usr/bin/pip-python"' >> $HOME/.bashrc
96+
$ . $HOME/.bashrc
4497

45-
$ easy_install pip
98+
99+
For Debian / Ubuntu Linux installation:
100+
---------------------------------------
101+
102+
.. code-block:: console
103+
104+
# apt-get install python-pip
105+
106+
or
107+
108+
.. code-block:: console
109+
110+
$ sudo apt-get install python-pip
46111

47112

48113
Virtual Environments
49114
--------------------
50115

51-
A Virtual Environment is a tool to keep the dependencies required by different projects
52-
in separate places, by creating virtual Python environments for them. It solves the
53-
"Project X depends on version 1.x but, Project Y needs 4.x" dilemma, and keeps
116+
A Virtual Environment is a tool to keep the dependencies required by different projects
117+
in separate places, by creating virtual Python environments for them. It solves the
118+
"Project X depends on version 1.x but, Project Y needs 4.x" dilemma, and keeps
54119
your global site-packages directory clean and manageable.
55120

56121
For example, you can work on a project which requires Django 1.3 while also
57122
maintaining a project which requires Django 1.0.
58123

59-
To start using and see more information: `Virtual Environments <http://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst>`_ docs.
124+
To start using and see more information: `Virtual Environments <http://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst>`_ docs.
60125

61126
You can also use :ref:`virtualenvwrapper <virtualenvwrapper-ref>` to make it easier to
62127
manage your virtual environments.
@@ -65,4 +130,3 @@ manage your virtual environments.
65130

66131
This page is a remixed version of `another guide <http://www.stuartellis.eu/articles/python-development-windows/>`_,
67132
which is available under the same license.
68-

0 commit comments

Comments
 (0)