标签:dir 安装 sql 变量 dev rap vim amp prefix
1.安装必要库
yum -y install gcc yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
2.下载python源码:https://www.python.org/downloads/source/
# 解压源码 tar -zxvf Python-3.7.4.tgz # 建立一个空文件夹,用于存放python3程序 mkdir /usr/local/python3 # 执行配置文件,编译,编译安装 cd Python-3.7.4 ./configure --prefix=/usr/local/python3 make && make install # 建立软连接 ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
3.测试python3和pip3
python3 pip3 --version
4.配置虚拟环境
# 安装virtualenv pip3 install virtualenv -i https://pypi.douban.com/simple/ # 安装virtualenvwrapper pip3 install virtualenvwrapper -ihttps://pypi.douban.com/simple/ # 配置环境变量vim /etc/bashrc,插入以下代码: export WORKON_HOME=/data/virtualenv # 虚拟环境存放目录 export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=‘--no-site-packages‘#创建纯净环境 export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 # python3 source /usr/local/python3/bin/virtualenvwrapper.sh # 使环境变量立即生效 source /etc/bashrc # 测试 workon mkvirtualenv test rmvirtualenv test
标签:dir 安装 sql 变量 dev rap vim amp prefix
原文地址:https://www.cnblogs.com/konglingxi/p/12064149.html