Centos7安装django

Centos7安装django

1、安装python(建议是3.8及以上版本)

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
下载python安装包,例如:python3.8.10.tgz
tar -zxvf Python-3.8.10.tgz
mkdir /usr/lib/python3.8
cd Python-3.8.10
./configure --prefix=/usr/lib/python3.8
make && make install
ln -s /usr/lib/python3.8/bin/python3.8 /usr/bin/python3
ln -s /usr/lib/python3.8/bin/pip3.8 /usr/bin/pip3

2、Pip安装django

python3 -m pip install Django
ln -s /usr/lib/python3.8/bin/django-admin /usr/bin/django-admin

3、创建django项目

cd /usr/lib/python3.8/lib/python3.8/site-packages
django-admin startproject MatlabAutoInstall

4、卸载django

pip3 show django  #找到输出中的Location: /usr/lib/python3/dist-packages
rm -rf Location/django
rm -rf Location/Django-*
docker run -idt --name auto_install_matlab -p 6379:6379 -p 8000:8000 --restart always auto_install_matlab:2.0 /bx/etc/init.sh

你可能感兴趣的:(python,django,sqlite,python)