跟着Leo-Bian学习:
1、Ubuntu系统内置了Python3
1.1、安装pip
sudo apt-get install python3-pip
1.2安装Python虚拟环境(虚拟环境有助于不同项目环境隔离)
#在Ubuntu中创建虚拟环境是需要virtualenv的,所以在创建虚拟环境之前还是要先安装virtualenv
sudo apt-get install python3-virtualenv
#当前目录下或者切换到你想创建虚拟环境的文件夹输入命令“virtualenv venv”,其中venv是虚拟环境的名字
virtualenv venv
#输入命令“source activate”,方可激活虚拟环境,此时demo已经被括号括起来了
source ./venv/bin/activate
2 安装Postgresql数据库
地址:https://www.postgresql.org/download/linux/ubuntu/https://www.postgresql.org/download/linux/ubuntu/
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql