3
3
Installation
4
4
============
5
5
6
- Flask depends on two external libraries, `Werkzeug
6
+ Flask depends on some external libraries, like `Werkzeug
7
7
<http://werkzeug.pocoo.org/> `_ and `Jinja2 <http://jinja.pocoo.org/2/ >`_.
8
8
Werkzeug is a toolkit for WSGI, the standard Python interface between web
9
9
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
13
13
could do that, but the most kick-ass method is virtualenv, so let's have a look
14
14
at that first.
15
15
16
- You will need Python 2.6 or higher to get started, so be sure to have an
16
+ You will need Python 2.6 or newer to get started, so be sure to have an
17
17
up-to-date Python 2.x installation. For using Flask with Python 3 have a
18
18
look at :ref: `python3-support `.
19
19
@@ -67,7 +67,7 @@ folder within::
67
67
$ cd myproject
68
68
$ virtualenv venv
69
69
New python executable in venv/bin/python
70
- Installing distribute ............done.
70
+ Installing setuptools, pip ............done.
71
71
72
72
Now, whenever you want to work on a project, you only have to activate the
73
73
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::
113
113
$ git clone http://github.com/mitsuhiko/flask.git
114
114
Initialized empty Git repository in ~/dev/flask/.git/
115
115
$ cd flask
116
- $ virtualenv venv --distribute
116
+ $ virtualenv venv
117
117
New python executable in venv/bin/python
118
- Installing distribute ............done.
118
+ Installing setuptools, pip ............done.
119
119
$ . venv/bin/activate
120
120
$ python setup.py develop
121
121
...
@@ -129,45 +129,53 @@ To just get the development version without git, do this instead::
129
129
130
130
$ mkdir flask
131
131
$ cd flask
132
- $ virtualenv venv --distribute
132
+ $ virtualenv venv
133
133
$ . venv/bin/activate
134
134
New python executable in venv/bin/python
135
- Installing distribute ............done.
135
+ Installing setuptools, pip ............done.
136
136
$ pip install Flask==dev
137
137
...
138
138
Finished processing dependencies for Flask==dev
139
139
140
140
.. _windows-easy-install :
141
141
142
- `pip ` and `distribute ` on Windows
143
- -----------------------------------
142
+ `pip ` and `setuptools ` on Windows
143
+ ---------------------------------
144
+
145
+ Sometimes getting the standard "Python packaging tools" like *pip *, *setuptools *
146
+ and *virtualenv * can be a little trickier, but nothing very hard. The two crucial
147
+ packages you will need are setuptools and pip - these will let you install
148
+ anything else (like virtualenv). Fortunately there are two "bootstrap scripts"
149
+ you can run to install either.
150
+
151
+ If you don't currently have either, then `get-pip.py ` will install both for you
152
+ (you won't need to run ez_setup.py).
153
+
154
+ `get-pip.py `_
144
155
145
- On Windows, installation of `easy_install ` is a little bit trickier, but still
146
- quite easy. The easiest way to do it is to download the
147
- `distribute_setup.py `_ file and run it. The easiest way to run the file is to
148
- open your downloads folder and double-click on the file.
156
+ To install the latest setuptools, you can use its bootstrap file:
149
157
150
- Next, add the `easy_install ` command and other Python scripts to the
151
- command search path, by adding your Python installation's Scripts folder
152
- to the `PATH ` environment variable. To do that, right-click on the
153
- "Computer" icon on the Desktop or in the Start menu, and choose "Properties".
154
- Then click on "Advanced System settings" (in Windows XP, click on the
155
- "Advanced" tab instead). Then click on the "Environment variables" button.
156
- Finally, double-click on the "Path" variable in the "System variables" section,
157
- and add the path of your Python interpreter's Scripts folder. Be sure to
158
- delimit it from existing values with a semicolon. Assuming you are using
159
- Python 2.7 on the default path, add the following value::
158
+ `ez_setup.py `_
160
159
160
+ Either should be double-clickable once you download them. If you already have pip,
161
+ you can upgrade them by running::
161
162
162
- ;C:\Python27\Scripts
163
+ > pip install --upgrade pip setuptools
163
164
164
- And you are done! To check that it worked, open the Command Prompt and execute
165
- `` easy_install ``. If you have User Account Control enabled on Windows Vista or
166
- Windows 7, it should prompt you for administrator privileges .
165
+ Most often, once you pull up a command prompt you want to be able to type `` pip ``
166
+ and `` python `` which will run those things, but this might not automatically happen
167
+ on Windows, because it doesn't know where those executables are (give either a try!) .
167
168
168
- Now that you have ``easy_install ``, you can use it to install ``pip ``::
169
+ To fix this, you should be able to navigate to your Python install directory
170
+ (e.g ``C:\Python27 ``), then go to ``Tools ``, then ``Scripts ``; then find the
171
+ ``win_add2path.py `` file and run that. Open a **new ** Command Prompt and
172
+ check that you can now just type ``python `` to bring up the interpreter.
169
173
170
- > easy_install pip
174
+ Finally, to install ` virtualenv `_, you can simply run::
171
175
176
+ > pip install virtualenv
177
+
178
+ Then you can be off on your way following the installation instructions above.
172
179
173
- .. _distribute_setup.py : http://python-distribute.org/distribute_setup.py
180
+ .. _get-pip.py : https://raw.github.com/pypa/pip/master/contrib/get-pip.py
181
+ .. _ez_setup.py : https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
0 commit comments