老是觉的学习东西有点猴子掰玉米的感受。今天就从新再掰一次吧。html
Installation:python
安装以前建议先安装virtualenv,这个东东是帮助你在多个python版本之间保持同步,不至于python版本变化了,项目就奔溃了。linux
某些程序猿的装备好些,可能用的是mac,自有类linux的安装方法。无奈本屌丝只能在win下来写写程序。因此只提供win的virtualenv安装方法:git
到这里下载http://flask.pocoo.org/docs/installation/#windows-easy-install, 建立python 文件,拷贝 distribute_setup.py的内容。而后双击便可。flask
也可参考这篇文章,很是详细:http://f.dataguru.cn/thread-36396-1-1.htmlwindows
1. 安装pip : easy_install.py pipide
2. 安装virtualenv: easy_install.py virtualenv学习
安装完成记得在环境变量里面添加路径。ui
APP:spa
如今新建立一个文件夹,给这个文件夹设置python环境。
F:\>cd flask F:\flask>cd picshow F:\flask\picshow>virtualenv env New python executable in env\Scripts\python.exe Installing Setuptools........................................................... ................................................................................ ................................................................................ .......................done. Installing Pip.................................................................. ................................................................................ ................................................................................ ................................................................................ .....................done. F:\flask\picshow>
接下来激活这个环境
env\Scripts\activate
最后,为应用添加Flask:
F:\flask\picshow>env\Scripts\activate (env) F:\flask\picshow>pip install Flask Downloading/unpacking Flask Downloading Flask-0.10.1.tar.gz (544kB): 544kB downloaded Running setup.py egg_info for package Flask warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' no previously-included directories found matching 'docs\_themes\.git' Downloading/unpacking Werkzeug>=0.7 (from Flask) Downloading Werkzeug-0.9.4.tar.gz (1.1MB): 1.1MB downloaded Running setup.py egg_info for package Werkzeug warning: no files found matching '*' under directory 'werkzeug\debug\templat es' warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' Downloading/unpacking Jinja2>=2.4 (from Flask) Downloading Jinja2-2.7.1.tar.gz (377kB): 377kB downloaded Running setup.py egg_info for package Jinja2 warning: no files found matching '*' under directory 'custom_fixers' warning: no previously-included files matching '*' found under directory 'do cs\_build' warning: no previously-included files matching '*.pyc' found under directory 'jinja2' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'jinja2' warning: no previously-included files matching '*.pyo' found under directory 'docs' Downloading/unpacking itsdangerous>=0.21 (from Flask) Downloading itsdangerous-0.23.tar.gz (46kB): 46kB downloaded Running setup.py egg_info for package itsdangerous warning: no previously-included files matching '*' found under directory 'do cs\_build' Downloading/unpacking markupsafe (from Jinja2>=2.4->Flask) Downloading MarkupSafe-0.18.tar.gz Running setup.py egg_info for package markupsafe Installing collected packages: Flask, Werkzeug, Jinja2, itsdangerous, markupsafe Running setup.py install for Flask warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' no previously-included directories found matching 'docs\_themes\.git' Running setup.py install for Werkzeug warning: no files found matching '*' under directory 'werkzeug\debug\templat es' warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' Running setup.py install for Jinja2 warning: no files found matching '*' under directory 'custom_fixers' warning: no previously-included files matching '*' found under directory 'do cs\_build' warning: no previously-included files matching '*.pyc' found under directory 'jinja2' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'jinja2' warning: no previously-included files matching '*.pyo' found under directory 'docs' Running setup.py install for itsdangerous warning: no previously-included files matching '*' found under directory 'do cs\_build' Running setup.py install for markupsafe building 'markupsafe._speedups' extension ========================================================================== WARNING: The C extension could not be compiled, speedups are not enabled. Failure information, if any, is above. Retrying the build without the C extension now. ========================================================================== WARNING: The C extension could not be compiled, speedups are not enabled. Plain-Python installation succeeded. ========================================================================== Successfully installed Flask Werkzeug Jinja2 itsdangerous markupsafe Cleaning up... (env) F:\flask\picshow>