Python Flask环境搭建

尽管之前多次部署过Python的Flask环境,由于没有做文档输出工作,导致后面部署时每次都得重新去填之前填过的坑,为了方便自己,也为了工作效率的提升,于是自己花了一点时间重新实验并且整理出来部署的文档,包括一键部署Flask环境脚本install.sh,和Flask环境需要的扩展的安装包packages.txt!

全部贴在代码区域!

下面是一键安装脚本install.sh

#! /usr/bin/bash
#version v1.0
# by andy.zhu
path=/opt/
install_basic_packages(){
cd $path
yum install -y mysql-devel python-devel  openssl-devel sqlite-devel  sqlite2-devel libxml2-devel libxslt-devel libffi-devel zlib zlib-devel  libjpeg libjpeg-level  freetype freetype-devel
}
install_python()
{
cd $path
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar -xvf Python-2.7.10.tgz
cd Python-2.7.10
./configure
make
make install
mv /usr/bin/python /usr/bin/python_old
cp /usr/local/bin/python2.7 /usr/bin/python
sed -i '1s/python/python2.6/p' /usr/bin/yum
cd $path
}
install_pip()
{
wget https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz --no-check-certificate
cd pip-1.2.1
python setup.py  install
pip install pip==7.1.0
cd $path
}
install_setuptools()
{
wget --no-check-certificate
tar xvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py install
cd $path
}
install_PIL()
{
wget
tar xvf Imaging-1.1.7.tar.gz
cd Imaging-1.1.7
python setup.py build_ext -i
sed -i 's/TCL_ROOT \= None/TCL_ROOT \= \"\/usr\/lib64\/\"/g' setup.py
sed -i 's/JPEG_ROOT \= None/JPEG_ROOT \= \"\/usr\/lib64\/\"/g' setup.py
sed -i 's/ZLIB_ROOT \= None/ZLIB_ROOT \= \"\/usr\/lib64\/\"/g' setup.py
sed -i 's/TIFF_ROOT \= None/TIFF_ROOT \= \"\/usr\/lib64\/\"/g' setup.py
sed -i 's/FREETYPE_ROOT \= None/FREETYPE_ROOT \= \"\/usr\/lib64\/\"/g' setup.py
sed -i 's/LCMS_ROOT \= None/LCMS_ROOT \= \"\/usr\/lib64\/\"/g' setup.py
python setup.py install
cd $path
}
install_pysqlite()
{
wget https://pypi.python.org/packages/source/p/pysqlite/pysqlite-2.5.6.tar.gz#md5=1b2f338c8d6db971e34edb799a92e2ee --no-check-certificate
tar xvf pysqlite-2.5.6.tar.gz
cd pysqlite-2.5.6
python setup.py install
cd $path
}
install_Twisted()
{
wget https://pypi.python.org/packages/source/T/Twisted/Twisted-15.3.0.tar.bz2#md5=b58e83da2f00b3352afad74d0c5c4599 --no-check-certificate
tar xvf Twisted-15.3.0.tar.bz2
cd Twisted-15.3.0
python setup.py install
cd $path
}
install_pip_packages()
{
pip install `cat pip_packages.txt`
cd $path
}
main()
{
install_basic_packages
install_python
install_setuptools
install_pip
install_PIL
install_pysqlite
install_Twisted
install_pip_packages
}
main
下面是需要安装的python一些库,整理在packages.txt
alembic==0.7.7
aniso8601==1.0.0
Babel==2.0
backports.ssl-match-hostname==3.4.0.2
beautifulsoup4==4.4.0
bleach==1.4.1
blinker==1.4
certifi==2015.4.28
cffi==1.1.2
characteristic==14.3.0
crypto==1.4.1
cryptography==0.9.3
cssselect==0.9.1
dominate==2.1.12
enum34==1.0.4
Flask==0.10.1
Flask-Babel==0.9
Flask-Bootstrap==3.3.5.6
Flask-Email==1.4.4
Flask-HTTPAuth==2.5.0
Flask-Login==0.2.11
Flask-Mail==0.9.1
Flask-Migrate==1.4.0
Flask-Moment==0.5.0
Flask-PageDown==0.2.1
Flask-RESTful==0.3.4
Flask-Script==2.0.5
Flask-SQLAlchemy==2.0
Flask-WTF==0.12
html5lib==0.999999
idna==2.0
ipaddress==1.0.14
itsdangerous==0.24
Jinja2==2.8
lxml==3.4.4
Mako==1.0.1
Markdown==2.6.2
MarkupSafe==0.23
MySQL-python==1.2.5
Naked==0.1.31
oauthlib==1.0.1
pyasn1==0.1.8
pycparser==2.14
pycrypto==2.6.1
pyOpenSSL==0.15.1
pyparsing==2.0.2
python-dateutil==2.4.2
pytz==2015.4
PyYAML==3.11
queuelib==1.2.2
requests==2.7.0
requests-oauthlib==0.5.0
Scrapy==1.0.1
setuptools==16.0
shellescape==3.4.1
six==1.9.0
speaklater==1.3
SQLAlchemy==1.0.8
tornado==4.2.1
tweepy==3.3.0
w3lib==1.11.0
Werkzeug==0.10.4
wheel==0.24.0
WTForms==2.0.2
zope.interface==4.1.2

下面关于Python的文章您也可能喜欢,不妨看看:

Python:在指定目录下查找满足条件的文件 

Python2.7.7源码分析 

无需操作系统直接运行 Python 代码 

CentOS上源码安装Python3.4 

《Python核心编程 第二版》.(Wesley J. Chun ).[高清PDF中文版]

《Python开发技术详解》.( 周伟,宗杰).[高清PDF扫描版+随书视频+代码]

Python脚本获取Linux系统信息

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15993.html