2021-05-12 14:32:11
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 http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz --no-check-certificate
tar xvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py install
cd $path
}
install_PIL()
{
wget http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
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:在指定目錄下查詢滿足條件的檔案 http://www.linuxidc.com/Linux/2015-08/121283.htm
Python2.7.7原始碼分析 http://www.linuxidc.com/Linux/2015-08/121168.htm
無需作業系統直接執行 Python 程式碼 http://www.linuxidc.com/Linux/2015-05/117357.htm
CentOS上原始碼安裝Python3.4 http://www.linuxidc.com/Linux/2015-01/111870.htm
《Python核心程式設計 第二版》.(Wesley J. Chun ).[高清PDF中文版] http://www.linuxidc.com/Linux/2013-06/85425.htm
《Python開發技術詳解》.( 周偉,宗傑).[高清PDF掃描版+隨書視訊+程式碼] http://www.linuxidc.com/Linux/2013-11/92693.htm
Python指令碼獲取Linux系統資訊 http://www.linuxidc.com/Linux/2013-08/88531.htm
在Ubuntu下用Python搭建桌面演算法交易研究環境 http://www.linuxidc.com/Linux/2013-11/92534.htm
Python 語言的發展簡史 http://www.linuxidc.com/Linux/2014-09/107206.htm
相關文章