Django使用问题记录

1.python3下出现问题(首先安装pymysql与mysqlclient):
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
解决方法:
在项目的__init__.py文件中添加如下内容:
import pymysql
pymysql.version_info = (1, 3, 13, "final", 0)
pymysql.install_as_MySQLdb()

2. RuntimeError: cryptography is required for sha256_password or caching_sha2_password
解决方法:
pip install cryptography

3. building 'MySQLdb._mysql' extension

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\softwareinstall\python\python
38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:
\\Windows\\Temp\\pip-install-3oczd27q\\mysqlclient\\setup.py'"'"'; __file__='"'"
'C:\\Windows\\Temp\\pip-install-3oczd27q\\mysqlclient\\setup.py'"'"';f=getattr(t
okenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '
"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --
record 'C:\Windows\Temp\pip-record-1k5s4hqn\install-record.txt' --single-version
-externally-managed --compile --install-headers 'd:\softwareinstall\python\pytho
n38-32\Include\mysqlclient' Check the logs for full command output.

解决方法:

 这个地址下载自己版本对应的资源
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient

然后执行pip install mysqlclient-1.4.6-cp38-cp38-win32.whl

 

 

 

 

 

参考内容:
a) https://blog.csdn.net/weixin_45476498/article/details/100098297
b) https://blog.csdn.net/lpw_cn/article/details/103978909

c) mysqlclient安装问题: https://blog.csdn.net/cn_1937/article/details/81533544

posted @ 2020-02-18 11:54  jiguanghover  阅读(165)  评论(0编辑  收藏  举报