Django从本地迁移至云服务器(Centos7.2)所遇到的问题

Centos7.2升级python2.7.5至3.6.0
1.下载python3.6:wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
2.解压:tar -xzf Python-3.6.4.tgz
3.安装:cd Python-3.6.4
./configure —prefix=/usr/local/python3.6
make
make install
4.备份:mv /usr/bin/python /usr/bin/python2.7.5
5.修改软连接:
ln -fs /usr/local/python3.6/bin/python3.6 /usr/bin/python
ln -fs /usr/local/python3.6/bin/pip3.6 /usr/bin/pip
6.验证:python -V
pip -V
7.修改yum文件:
vi /usr/bin/yum
vi /usr/libexec/urlgrabber-ext-down
第一行改为:#!/usr/bin/python2.7
8.升级:
python -m pip install —upgrade pip
报错:编译报错configure: error: no acceptable C compiler found in $PATH
安装GCC软件套件:yum install gcc
Make install报错ipimport.ZipImportError: can’t decompress data
安装zlip依赖包:yum -y install zlib*
yum -y install zlib zlib-devel

安装Django

  1. pip install django==2.1.7
  2. 启动django报错ModuleNotFoundError: No module named ‘_sqlite3’
    安装sqlite 模块:yum install sqlite-devel
    再重新到python文件目录下编译python并指定python3的安装路径
    ./configure —prefix=/usr/local/python3.6
    make
    make install
  3. 报错ModuleNotFoundError: No module named ‘slugify’
    pip install awesome-slugify
    报错run command “pip install Pillow”
    pip install pillow

6 thoughts on “Django从本地迁移至云服务器(Centos7.2)所遇到的问题

发表评论