环境:CentOS7.7
以下命令若执行不成功 试着在命令开头加上sudo
1、docker
# 先升级一下yum
yum -y update
# 设置docker的阿里源,如果第一步执行失败,就先执行下面那条,然后再回来执行这条;
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y yum-utils device-mapper-persistent-data lvm2
yum install -y docker-ce-18.03.1.ce-1.el7.centos
systemctl start docker
systemctl enable docker
2、virtualenv、virtualenvwrapper
pip3 install --upgrade pip
pip3 install virtualenv
pip3 install pbr
pip3 install virtualenvwrapper
yum install mysql-devel gcc gcc-devel python36-devel python-devel
# 设置virtualenv参数
vi ~/.bashrc
# 将以下内容复制黏贴到~/.bashrc文件的最后
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
# 让bashrc文件立刻生效
source ~/.bashrc
# 创建虚拟环境
mkvirtualenv myenv
# 切换至myenv虚拟环境
workon myenv
总结使用方法:
mkvirtualenv myenv:创建运行环境myenv
workon myenv: 从其它环境切换到 myenv环境
deactivate: 退出终端环境
rmvirtualenv myenv:删除运行环境myenv
mkproject myproject:创建myproject项目和运行环境myproject
mktmpenv:创建临时运行环境
lsvirtualenv: 列出可用的运行环境
lssitepackages: 列出当前环境已安装的包