标签:block eve 国内 mysq expand server nec pypi ucs
上篇文章配置了虚机基础环境,本篇文章介绍配置python开发环境
使用国内yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-
Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum -y install openssl-devel readline-devel unzip
下载python源码包
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
安装
tar -xzf Python-3.6.2.tgz
./configure --prefix=/usr/local/python36
make && make install
sudo tee /etc/pip.conf <<EOF
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
[list]
format=columns
EOF
初始化环境,推荐使用普通用户
/usr/local/python36/bin/pip3 install virtualenv
/usr/local/python36/bin/virtualenv ./python36env
source /data/python36env/bin/activate
pip install django
安装mariadb
yum -y install mariadb mariadb-server mariadb-devel
[mysqld]
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
source /data/python36env/bin/activate
pip install mysqlclient
mysql -uroot -p123456 -e "create database django CHARACTER SET utf8;"
安装vim
yum -y install vim
tee ~/.vimrc <<EOF
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set fileformat=unix
set nobomb
set ff=unix
set ambiwidth=double
set fileencodings=utf-8,ucs-bom,cp936
syntax on
filetype plugin on
set nocompatible
set completeopt=preview
set ai
set hls
set nu
EOF
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django',
'USER': 'root',
'PASSWORD': '123456',
'HOST': '127.0.0.1',
'PORT': 3306,
'OPTIONS':{
'init_command': 'SET default_storage_engine=INNODB;',
},
}
}
标签:block eve 国内 mysq expand server nec pypi ucs
原文地址:https://www.cnblogs.com/guigujun/p/9109433.html