Browse Source

Update windows installation and other notes

Making allowance for new convenience of `get-pip.py` that automatically installs setuptools and pip together.

Stop recommending distribute, which has now been merged into setuptools.
pull/977/head
Matt Iversen 11 years ago
parent
commit
a8e88bebd1
  1. 68
      docs/installation.rst

68
docs/installation.rst

@ -3,7 +3,7 @@
Installation
============
Flask depends on two external libraries, `Werkzeug
Flask depends on some external libraries, like `Werkzeug
<http://werkzeug.pocoo.org/>`_ and `Jinja2 <http://jinja.pocoo.org/2/>`_.
Werkzeug is a toolkit for WSGI, the standard Python interface between web
applications and a variety of servers for both development and deployment.
@ -13,7 +13,7 @@ So how do you get all that on your computer quickly? There are many ways you
could do that, but the most kick-ass method is virtualenv, so let's have a look
at that first.
You will need Python 2.6 or higher to get started, so be sure to have an
You will need Python 2.6 or newer to get started, so be sure to have an
up-to-date Python 2.x installation. For using Flask with Python 3 have a
look at :ref:`python3-support`.
@ -67,7 +67,7 @@ folder within::
$ cd myproject
$ virtualenv venv
New python executable in venv/bin/python
Installing distribute............done.
Installing setuptools, pip............done.
Now, whenever you want to work on a project, you only have to activate the
corresponding environment. On OS X and Linux, do the following::
@ -113,9 +113,9 @@ Get the git checkout in a new virtualenv and run in development mode::
$ git clone http://github.com/mitsuhiko/flask.git
Initialized empty Git repository in ~/dev/flask/.git/
$ cd flask
$ virtualenv venv --distribute
$ virtualenv venv
New python executable in venv/bin/python
Installing distribute............done.
Installing setuptools, pip............done.
$ . venv/bin/activate
$ python setup.py develop
...
@ -129,45 +129,53 @@ To just get the development version without git, do this instead::
$ mkdir flask
$ cd flask
$ virtualenv venv --distribute
$ virtualenv venv
$ . venv/bin/activate
New python executable in venv/bin/python
Installing distribute............done.
Installing setuptools, pip............done.
$ pip install Flask==dev
...
Finished processing dependencies for Flask==dev
.. _windows-easy-install:
`pip` and `distribute` on Windows
-----------------------------------
`pip` and `setuptools` on Windows
---------------------------------
Sometimes getting the standard "Python packaging tools" like *pip*, *setuptools*
and *virtualenv* can be a little trickier, but nothing very hard. The two crucial
packages you will need are setuptools and pip - these will let you install
anything else (like virtualenv). Fortunately there are two "bootstrap scripts"
you can run to install either.
If you don't currently have either, then `get-pip.py` will install both for you
(you won't need to run ez_setup.py).
`get-pip.py`_
On Windows, installation of `easy_install` is a little bit trickier, but still
quite easy. The easiest way to do it is to download the
`distribute_setup.py`_ file and run it. The easiest way to run the file is to
open your downloads folder and double-click on the file.
To install the latest setuptools, you can use its bootstrap file:
Next, add the `easy_install` command and other Python scripts to the
command search path, by adding your Python installation's Scripts folder
to the `PATH` environment variable. To do that, right-click on the
"Computer" icon on the Desktop or in the Start menu, and choose "Properties".
Then click on "Advanced System settings" (in Windows XP, click on the
"Advanced" tab instead). Then click on the "Environment variables" button.
Finally, double-click on the "Path" variable in the "System variables" section,
and add the path of your Python interpreter's Scripts folder. Be sure to
delimit it from existing values with a semicolon. Assuming you are using
Python 2.7 on the default path, add the following value::
`ez_setup.py`_
Either should be double-clickable once you download them. If you already have pip,
you can upgrade them by running::
;C:\Python27\Scripts
> pip install --upgrade pip setuptools
And you are done! To check that it worked, open the Command Prompt and execute
``easy_install``. If you have User Account Control enabled on Windows Vista or
Windows 7, it should prompt you for administrator privileges.
Most often, once you pull up a command prompt you want to be able to type ``pip``
and ``python`` which will run those things, but this might not automatically happen
on Windows, because it doesn't know where those executables are (give either a try!).
Now that you have ``easy_install``, you can use it to install ``pip``::
To fix this, you should be able to navigate to your Python install directory
(e.g ``C:\Python27``), then go to ``Tools``, then ``Scripts``; then find the
``win_add2path.py`` file and run that. Open a **new** Command Prompt and
check that you can now just type ``python`` to bring up the interpreter.
> easy_install pip
Finally, to install `virtualenv`_, you can simply run::
> pip install virtualenv
Then you can be off on your way following the installation instructions above.
.. _distribute_setup.py: http://python-distribute.org/distribute_setup.py
.. _get-pip.py: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
.. _ez_setup.py: https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py

Loading…
Cancel
Save