Python报错No module named 'cv2'
原因:未安装opencv-python库
命令行模式安装:pip3 install opencv-python
Python错误:no module named pylab
需要安装numpy、spy和matplotlib才能获得pylab
python pymysql.err.InternalError: (1366, "Incorrect string value: '\\xE9\\x9F\\xA9\\xE6\\xA2\\x85...
修改数据库编码格式: Alter database 数据库名称 character set utf8 collate utf8_general_ci;
修改表编码格式: Alter table 表名称 convert to character set utf8;
查看数据库的编码格式: show create database 数据库名称;
Mysql Too many connections解决方案
set GLOBAL max_connections = 500;
set GLOBAL wait_timeout = 300;
set GLOBAL interactive_timeout = 600;
Mac python3 matplotlib中文乱码解决
下载字体
http://www.fontpalace.com/font-download/SimHei/
复制字体到matplotlib字体目录下
cp SimHei.ttf ~/.pyenv/versions/3.6.4/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf
matplotlibrc配置文件修改
终端运行python后执行如下命令获取matplotlibrc配置文件路径
import matplotlib
matplotlib.matplotlib_fname()
记下地址,终端切换到该地址后修改matplotlibrc文件,添加如下内容:
vi matplotlibrc
添加内容:
font.family : sans-serif
font.sans-serif : SimHei, DejaVu Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
其中SimHei为第一步下载的字体名称
清除matplotlib字体缓存
rm -rf ~/.matplotlib/*.cache
rm fontList.json
重新运行python程序即可正常显示中文