首页 > 代码库 > Mac下的python flask小记

Mac下的python flask小记

安装Flask

调用python3解释器来创建一个flask虚拟环境,python 3.4以下的版本都不行。首先通过以下命令获取python3解释器的路径:

which python3

结果:/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

然后在当前路径下创建一个flask项目,命名为microflask:

mkdir microflask

在microflask文件夹中创建一个flask虚拟环境(会在当前路径下创建一个flask文件夹):

/Library/Frameworks/Python.framework/Versions/3.5/bin/python3 -m venv flask

接下来调用虚拟环境的pip来安装flask及其扩展(在虚拟环境下安装,如果删除虚拟环境所致目录,则以下安装都将被删除):

flask/bin/pip install flaskflask/bin/pip install flask-loginflask/bin/pip install flask-openidflask/bin/pip install flask-mailflask/bin/pip install sqlalchemy-migrateflask/bin/pip install flask-whooshalchemyflask/bin/pip install flask-wtfflask/bin/pip install flask-babelflask/bin/pip install guess_languageflask/bin/pip install flipflopflask/bin/pip install coverage

 

 
 

Mac下的python flask小记