进入python虚拟环境 执行以下 命令
source env/bin/active 激活并切换虚拟环境
安装
pip3 install django
创建django项目
django-admin startproject 项目名称
报错:bash: django-admin: command not found...
- 解决:
python3 /usr/local/python3/lib/python3.7/site-
packages/django/bin/django-admin.py startproject mypro
cd 项目中 接着
python manage.py startapp 子应用名称
① yum -y install sqlite-devel
② 切换到python-3.7.4
③ 执行:./configure --prefix=/usr/local/python3
④ make
⑤ 如果没有权限:sudo make install // 有权限:make install
python manage.py startapp 子应用名称
cd ~
wget https://www.sqlite.org/2019/sqlite-autoconf-3270200.tar.gz
tar -zxvf sqlite-autoconf-3270200.tar.gz
cd sqlite-autoconf-3270200./configure --prefix=/usr/local
make
make install
find /usr/ -name sqlite3
cd ~
ls
删除没有用的文件
rm -rf sqlite-autoconf-3270200.tar.gz
rm -rf sqlite-autoconf-3270200
更改旧的sqlite3
mv /usr/bin/sqlite3 /usr/bin/sqlite3_old
软链接将新的sqlite3设置到/usr/bin目录下
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
将路径传递给共享库
export LD_LIBRARY_PATH="/usr/local/lib"
查看sqlite3有没有更新成功:
python3
import sqlite3
sqlite3.sqlite_version 3.27.1
- 启动django
cd 项目
python3 manage.py runserver 启动django服务
- 退出虚拟环境
deactivate