python

0、建立python3用户

groupadd py3
useradd -m -g py3 py3

1、安装python3依赖包

yum install -y zlib-devel bzip2-devel ncurses-devel sqlite-devel gdbm-devel xz-devel tk-devel readline-devel openssl-devel libffi-devel

或者

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev  libncurses5-dev libncursesw5-dev xz-utils tk-dev
sudo apt-get install -y wget curl llvm


2、在py3用户下安装pyenv

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

pyenv update
pyenv install --list

pyenv install 3.6.5

pyenv rehash
pyenv versions
pyenv global 3.6.5

3、配置pipy国内源

创建~/.pip/pip.conf文件:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com

4、安装pipenv

pip install --upgrade pip
pip install pipenv

5、初始化pipenv工作目录

pipenv --python 3.6 指定某一Python版本创建环境
编辑Pipfile文件,修改安装源为本地源:

[[source]]
url = "https://mirrors.aliyun.com/pypi/simple/"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.6"

6、安装数据库驱动

postgresql

sudo yum install -y libicu libicu-devel

sudo rpm -ivh postgresql10-libs-10.4-1PGDG.rhel7.x86_64.rpm
sudo rpm -ivh postgresql10-devel-10.4-1PGDG.rhel7.x86_64.rpm
sudo rpm -ivh postgresql10-devel-10.4-1PGDG.rhel7.x86_64.rpm

pipenv install psycopg2

SQL Server

sudo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sudo yum install freetds freetds-devel
pipenv install pymssql
posted @ 2018-05-03 09:56  javaite  阅读(184)  评论(0编辑  收藏  举报