#修改字符集
echo 'LANG="en_GB.utf8"' > /etc/sysconfig/i18n
LANG="en_GB.utf8"
#修改国内源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOSBase.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
#安装python依赖
yum -y install openssl-devel readline-devel unzip
#下载python3.6.2源码包
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
#安装编译
tar -xzf Python-3.6.2.tgz
cd Python-3.6.2
./configure --prefix=/usr/local/python36
make
make install
#配置pip
tee /etc/pip.conf <<-'EOF'
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
[list]
format=columns
EOF
#安装virtualenv
/usr/local/python36/bin/pip3 install virtualenv
#初始化env环境
mkdir ~/Desktop/usr/local
/python36/bin/virtualenv ~/Desktop/env
#进入env环境
source ~/Desktop/env/bin/activate
pip install "django>=1.11" ##安装django 1.11
pip install ipython ##安装ipython
#退出env环境
deactivate
#安装mysql
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install -y mysql mysql-server mysql-devel zlib-devel
source ~/Desktop/env/bin/activate
pip install pymysql
##编辑数据库配置文件my.cnf
vim /etc/my.cnf
[mysqld]
default-storage-engine = innodb
innodb_file_per_tablecollation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
#启动服务
service mysqld start
#mysql的安全设置 并配置密码
mysql_secure_installation
#新建django库
mysql -uroot -pxxxx -e "create database django CHARACTER SET utf8;
python3.6.2+django1.11+mysql 环境安装
最新推荐文章于 2024-08-29 15:54:17 发布