- 安裝python3
CentOS7系統(tǒng)自帶的Python版本是Python2.7,如需使用Python3.6壹若,需要自行安裝Python3.6嗅钻。
CentOS7安裝Python3.6有兩種方式:
- 使用Yum源安裝Python3.6
- 使用Python3.6源文件安裝
推薦使用CentOS7 Yum源安裝Python3.6。
CentOS7使用Yum源安裝Python3.6(已失效
)
IUS軟件源中包含了Python3.6店展,可以使用IUS軟件源安裝Python3.6养篓,查看如何安裝使用IUS軟件源
1)安裝IUS軟件源
#安裝EPEL依賴
yum install epel-release -y
#安裝IUS軟件源
yum install https://centos7.iuscommunity.org/ius-release.rpm -y
2)安裝Python3.6
yum install python36u -y
安裝Python3完成后的shell命令為python3.6,為了使用方便赂蕴,創(chuàng)建一個(gè)到python3的符號鏈接
ln -s /bin/python3.6 /bin/python3
3)安裝pip3
安裝完成python36u并沒有安裝pip柳弄,安裝pip
yum install python36u-pip -y
安裝pip完成后的shell命令為pip3.6,為了使用方便概说,創(chuàng)建一個(gè)到pip3的符號鏈接
ln -s /bin/pip3.6 /bin/pip3
CentOS7使用Yum源安裝Python3.6
1)安裝IUS軟件源
#安裝EPEL依賴
yum install epel-release -y
#安裝IUS軟件源
yum install https://mirrors.tuna.tsinghua.edu.cn/ius/ius-release-el7.rpm -y
2)安裝Python3.6
yum search python36
# 找到需要安裝的python包
yum install xxxx -y
## CentOS7使用源文件安裝Python3.6
1)在安裝Python3.6之前碧注,先安裝Python3.6需要的依賴:
sudo yum -y groupinstall development
sudo yum -y install zlib-devel
2)運(yùn)行如下命令安裝Python3.6
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xJf Python-3.6.0.tar.xz
cd Python-3.6.0
sudo ./configure
sudo make
sudo make install
安裝完成后,Python安裝在了`/usr/local`文件夾中糖赔,可運(yùn)行文件`/usr/local/bin`萍丐,庫文件`/usr/local/lib`
###- nginx配置文件
```vim /etc/nginx/conf.d/py.conf ```
server {
listen 80;
server_name 47.102.129.254;
client_max_body_size 100M;
location /static {
alias /root/code/FULL_BBS/static;
}
location /media {
alias /root/code/FULL_BBS/media/;
}
location / {
index index.html;
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
uwsgi_param UWSGI_SCRIPT FULL_BBS.wsgi;
uwsgi_param UWSGI_CHDIR /root/code/FULL_BBS;
}
}
###- uwsgi配置文件
```pip3 install uwsgi安裝失敗問題的解決```
- python --version 命令查看python版本
- yum search python3
- yum install python36u-devel.x86_64 -y
4.或者yum install gcc -y
```vim 項(xiàng)目最外層目錄/uwsgi.ini```
[uwsgi]
socket = 127.0.0.1:9090
master = true
workers = 2
reload-mercy = 10
vacuum = true
max-requests = 1000
limit-as = 512
buffer-size = 30000
flask項(xiàng)目配置
[uwsgi]
socket = 127.0.0.1:9090
processes = 4
threads = 2
master = true
pythonpath = /var/www/web/movie
module = manage
callable = app
memory-report = true
python3 manage.py db init
python3 manage.py db migrate
python3 manage.py db upgrade