python项目环境部署遇到的问题

1,Error loading MySQLdb module: No module named 'MySQLdb'

在python3中连接mysql数据库的时候,报这个错误。

解决方案:

sudo apt-get install python3-dev libmysqlclient-dev
sudo pip3 install mysqlclient

 

 

2,Django程序出现 ValueError: Incorrect timezone setting: Asia/Shanghai

在Ubuntu/Centos系统中安装时区支持;

echo "Asia/Shanghai" > /etc/timezone && \
apt install -y tzdata && \
rm -f /etc/localtime && \
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

 

再在Django的settings.py中配置

TIME_ZONE = 'Asia/Shanghai'

 

 

3,Import error: cannot import name 'opentype'

解决方案:

pip install --upgrade google-auth-oauthlib

 

posted @ 2021-06-25 09:29  Jerry`  阅读(273)  评论(0编辑  收藏  举报