pycharm运行错误记录
Posted 智商不够_熬夜来凑
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pycharm运行错误记录相关的知识,希望对你有一定的参考价值。
NameError: name '_mysql' is not defined
创建ORM模型时,运行python startapp accounts报错,
解决办法:
在setting.py 添加如下代码:
import pymysql
pymysql.install_as_MySQLdb()
ModuleNotFoundError: No module named 'MySQLdb'
创建ORM模型报错,Did you install mysqlclient?
解决办法,安装mysqlclient
pip install mysqlclient
TypeError: __init__() got an unexpected keyword argument 'upload_to'
创建ORM用户表时,出现的错误提示,错误在在配置图片上传路径:
avatar = models.CharField('用户头像', upload_to='avatar', null=True, blank=True)
类型写错了,更改为
avatar = models.ImageField('用户头像', upload_to='avatar', null=True, blank=True)
再check一下,出现以下错误,根据提示安装Pillow即可
SystemCheckError: System check identified some issues:
ERRORS:
accounts.User.avatar: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
RuntimeError: cryptography is required for sha256_password or caching_sha2_password
运行python shell报错,解决办法如下:
pip3 install cryptography
以上是关于pycharm运行错误记录的主要内容,如果未能解决你的问题,请参考以下文章
错误记录PyCharm 运行 Python 程序报错 ( PEP 8: E402 module level import not at top of file )
错误记录PyCharm 运行 Python 程序报错 ( PEP 8: E402 module level import not at top of file )
错误记录PyCharm 运行 Python 程序报错 ( SyntaxError: Non-ASCII character ‘xe5‘ in file x.py on line 1, but )(代码
错误记录PyCharm 运行 Python 程序报错 ( PEP 8: E305 expected 2 blank lines after class or function definiti )(代