mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Fixed all H2 headings
Before, H2 fomratting was not consistent. Now, all H2 headings use over/under asterisks.
This commit is contained in:
@@ -33,8 +33,10 @@ described in the next section before you start building Python applications
|
||||
for real-world use. In particular, you should always install Setuptools and pip, as
|
||||
it makes it much easier for you to use other third-party Python libraries.
|
||||
|
||||
|
||||
****************
|
||||
Setuptools & Pip
|
||||
----------------
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
|
||||
@@ -53,8 +55,10 @@ To see if pip is installed, open a command prompt and run
|
||||
|
||||
To install pip, `follow the official pip installation guide <https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools.
|
||||
|
||||
|
||||
********************
|
||||
Virtual Environments
|
||||
--------------------
|
||||
********************
|
||||
|
||||
A Virtual Environment is a tool to keep the dependencies required by different projects
|
||||
in separate places, by creating virtual Python environments for them. It solves the
|
||||
|
||||
@@ -23,8 +23,10 @@ good for development. The version shipped with OS X may be out of date from the
|
||||
`official current Python release <https://www.python.org/downloads/mac-osx/>`_,
|
||||
which is considered the stable production version.
|
||||
|
||||
|
||||
**************
|
||||
Doing it Right
|
||||
--------------
|
||||
**************
|
||||
|
||||
Let's install a real version of Python.
|
||||
|
||||
@@ -89,8 +91,9 @@ Homebrew names the executable ``python2`` so that you can still run the system P
|
||||
$ python3 -V # Homebrew installed Python 3 interpreter (if installed)
|
||||
|
||||
|
||||
****************
|
||||
Setuptools & Pip
|
||||
----------------
|
||||
****************
|
||||
|
||||
Homebrew installs Setuptools and ``pip`` for you.
|
||||
|
||||
@@ -110,9 +113,9 @@ and is actively maintained.
|
||||
$ pip -V # pip pointing to the Homebrew installed Python 3 interpreter (if installed)
|
||||
|
||||
|
||||
|
||||
********************
|
||||
Virtual Environments
|
||||
--------------------
|
||||
********************
|
||||
|
||||
A Virtual Environment (commonly referred to as a 'virtualenv') is a tool to keep the dependencies required by different projects
|
||||
in separate places, by creating virtual Python environments for them. It solves the
|
||||
|
||||
@@ -52,8 +52,10 @@ described in the next section before you start building Python applications for
|
||||
real-world use. In particular, you should always install Setuptools, as it
|
||||
makes it much easier for you to use other third-party Python libraries.
|
||||
|
||||
|
||||
****************
|
||||
Setuptools + Pip
|
||||
----------------
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
|
||||
@@ -73,8 +75,9 @@ To see if pip is installed, open a command prompt and run
|
||||
To install pip, `follow the official pip installation guide <https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools.
|
||||
|
||||
|
||||
********************
|
||||
Virtual Environments
|
||||
--------------------
|
||||
********************
|
||||
|
||||
A Virtual Environment is a tool to keep the dependencies required by different projects
|
||||
in separate places, by creating virtual Python environments for them. It solves the
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
.. _install3-linux:
|
||||
|
||||
|
||||
############################
|
||||
Installing Python 3 on Linux
|
||||
============================
|
||||
############################
|
||||
|
||||
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
|
||||
|
||||
@@ -42,8 +44,9 @@ to read about `multiple Python versions available in Fedora`_.
|
||||
.. _multiple Python versions available in Fedora: https://developer.fedoraproject.org/tech/languages/python/multiple-pythons.html
|
||||
|
||||
|
||||
*********************
|
||||
Working with Python 3
|
||||
---------------------
|
||||
*********************
|
||||
|
||||
At this point, you may have system Python 2.7 available as well.
|
||||
|
||||
@@ -59,8 +62,10 @@ This will launch the Python 2 interpreter.
|
||||
|
||||
This will launch the Python 3 interpreter.
|
||||
|
||||
|
||||
****************
|
||||
Setuptools & Pip
|
||||
----------------
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
|
||||
@@ -90,8 +95,9 @@ However, when using virtual environments (described below), you don't need to
|
||||
care about that.
|
||||
|
||||
|
||||
*****************************
|
||||
Pipenv & Virtual Environments
|
||||
-----------------------------
|
||||
*****************************
|
||||
|
||||
The next step is to install Pipenv, so you can install dependencies and manage virtual environments.
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
.. _install3-osx:
|
||||
|
||||
|
||||
###############################
|
||||
Installing Python 3 on Mac OS X
|
||||
===============================
|
||||
###############################
|
||||
|
||||
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
|
||||
|
||||
@@ -17,8 +19,10 @@ good for development. The version shipped with OS X may be out of date from the
|
||||
`official current Python release <https://www.python.org/downloads/mac-osx/>`_,
|
||||
which is considered the stable production version.
|
||||
|
||||
|
||||
**************
|
||||
Doing it Right
|
||||
--------------
|
||||
**************
|
||||
|
||||
Let's install a real version of Python.
|
||||
|
||||
@@ -72,14 +76,16 @@ Now, we can install Python 3:
|
||||
|
||||
This will take a minute or two.
|
||||
|
||||
|
||||
***
|
||||
Pip
|
||||
---
|
||||
***
|
||||
|
||||
Homebrew installs ``pip`` pointing to the Homebrew'd Python 3 for you.
|
||||
|
||||
|
||||
*********************
|
||||
Working with Python 3
|
||||
---------------------
|
||||
*********************
|
||||
|
||||
At this point, you have the system Python 2.7 available, potentially the
|
||||
:ref:`Homebrew version of Python 2 <install-osx>` installed, and the Homebrew
|
||||
@@ -115,8 +121,9 @@ The rest of the guide will assume that ``python`` references Python 3.
|
||||
Python 3.7.1 # Success!
|
||||
|
||||
|
||||
*****************************
|
||||
Pipenv & Virtual Environments
|
||||
-----------------------------
|
||||
*****************************
|
||||
|
||||
The next step is to install Pipenv, so you can install dependencies and manage virtual environments.
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
.. _install3-windows:
|
||||
|
||||
|
||||
##############################
|
||||
Installing Python 3 on Windows
|
||||
==============================
|
||||
##############################
|
||||
|
||||
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
|
||||
|
||||
@@ -17,8 +19,10 @@ Once done, installing Python 3 is very simple, because Chocolatey pushes Python
|
||||
Once you've run this command, you should be able to launch Python directly from to the console.
|
||||
(Chocolatey is fantastic and automatically adds Python to your path.)
|
||||
|
||||
|
||||
****************
|
||||
Setuptools + Pip
|
||||
----------------
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_,
|
||||
which let you download, install and uninstall any compliant Python software
|
||||
@@ -30,8 +34,9 @@ All supported versions of Python 3 include pip, so just make sure it's up to dat
|
||||
python -m pip install -U pip
|
||||
|
||||
|
||||
*****************************
|
||||
Pipenv & Virtual Environments
|
||||
-----------------------------
|
||||
*****************************
|
||||
|
||||
The next step is to install Pipenv, so you can install dependencies and manage virtual environments.
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ other third-party Python libraries.
|
||||
.. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
|
||||
—*Kenneth Reitz*
|
||||
|
||||
|
||||
*******************
|
||||
Installation Guides
|
||||
-------------------
|
||||
*******************
|
||||
|
||||
These guides go over the proper installation of :ref:`Python <which-python>`
|
||||
for development purposes, as well as setuptools, pip and virtualenv.
|
||||
|
||||
@@ -8,8 +8,10 @@ Picking a Python Interpreter (3 vs 2)
|
||||
|
||||
.. _which-python:
|
||||
|
||||
|
||||
***************************
|
||||
The State of Python (3 & 2)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
***************************
|
||||
|
||||
When choosing a Python interpreter, one looming question is always present:
|
||||
"Should I choose Python 2 or Python 3"? The answer is a bit more subtle than
|
||||
@@ -23,8 +25,10 @@ The basic gist of the state of things is as follows:
|
||||
3. Python 2.7 will only receive necessary security updates until 2020 [#pep373_eol]_.
|
||||
4. The brand name "Python" encapsulates both Python 3 and Python 2.
|
||||
|
||||
|
||||
***************
|
||||
Recommendations
|
||||
~~~~~~~~~~~~~~~
|
||||
***************
|
||||
|
||||
|
||||
.. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
|
||||
@@ -41,8 +45,10 @@ I'll be blunt:
|
||||
simultaneously. Only supporting Python 3 for a new library you want to be widely adopted is a
|
||||
political statement and will alienate many of your users. This is not a problem — slowly, over the next three years, this will become less the case.
|
||||
|
||||
|
||||
*********
|
||||
So.... 3?
|
||||
~~~~~~~~~
|
||||
*********
|
||||
|
||||
If you're choosing a Python interpreter to use, I
|
||||
recommend you use the newest Python 3.x, since every version brings new and
|
||||
@@ -65,8 +71,10 @@ worry about. Note that Python 2.6 is end-of-life upstream, so you shouldn't
|
||||
try to write 2.6-compatible code unless you're being paid specifically to
|
||||
do that.
|
||||
|
||||
|
||||
***************
|
||||
Implementations
|
||||
~~~~~~~~~~~~~~~
|
||||
***************
|
||||
|
||||
When people speak of *Python* they often mean not just the language but also
|
||||
the CPython implementation. *Python* is actually a specification for a language
|
||||
|
||||
Reference in New Issue
Block a user