解决django项目报错很离谱的报错之RuntimeError: populate() isn't reentrant

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: 解决django项目报错很离谱的报错之RuntimeError: populate() isn't reentrant

image.png

1.看到这个报错是不是很懵逼

2.去修改这个文件

/usr/local/lib/python3.6/site-packages/django/apps/registry.py

image.png

3.到最后面发现是包安装的不够 就会报错

django==2.2.26
celery==5.0.5
mongoengine==0.22.1
djangorestframework==3.12.2
django-cors-headers==3.7.0
django-simple-captcha==0.5.13
django_celery_beat==2.2.0
drf-yasg==1.20.0
PyMySQL==1.0.2
mysqlclient==1.4.6
jsonfield==3.1.0
djangorestframework-jwt==1.11.0
django-filter==2.4.0
xlrd==2.0.1
xlwt==1.3.0
user-agents==2.2.0
psutil==5.8.0
pycryptodome==3.14.1
pyyaml==6.0

BZ:linux安装mysqlclient报错          OSError: mysql_config not found

OSError: mysql_config not found
安装:mysqlclient的时候报错

Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ej3mzpr2/mysqlclient_a06a405a81cb4c51972465eb6bf39a46/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ej3mzpr2/mysqlclient_a06a405a81cb4c51972465eb6bf39a46/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-22f2qu3x
cwd: /tmp/pip-install-ej3mzpr2/mysqlclient_a06a405a81cb4c51972465eb6bf39a46/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
mysql_config --version
mariadb_config --version
mysql_config --libs
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ej3mzpr2/mysqlclient_a06a405a81cb4c51972465eb6bf39a46/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-ej3mzpr2/mysqlclient_a06a405a81cb4c51972465eb6bf39a46/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-ej3mzpr2/mysqlclient_a06a405a81cb4c51972465eb6bf39a46/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
WARNING: Discarding http://mirrors.cloud.aliyuncs.com/pypi/packages/50/5f/eac919b88b9df39bbe4a855f136d58f80d191cfea34a3dcf96bf5d8ace0a/mysqlclient-2.1.1.tar.gz#sha256=828757e419fb11dd6c5ed2576ec92c3efaa93a0f7c39e263586d1ee779c3d782 (from http://mirrors.cloud.aliyuncs.com/pypi/simple/mysqlclient/) (requires-python:>=3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==2.1.1 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0rc1, 2.1.0, 2.1.1)
ERROR: No

matching distribution found for mysqlclient==2.1.1

 

解决办法:

yum install mysql-devel

再安装 pip3 install mysqlclient

View Code

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
2月前
|
Python
【Python】已解决:AttributeError: module ‘sys’ has no attribute ‘setdefaultencoding’
【Python】已解决:AttributeError: module ‘sys’ has no attribute ‘setdefaultencoding’
77 0
|
网络协议 机器人 Python
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
|
2月前
|
Python
【Python】已解决ModuleNotFoundError: No module named ‘requests’
【Python】已解决ModuleNotFoundError: No module named ‘requests’
379 2
|
2月前
|
XML API 数据格式
【Python】 已解决:ValueError: document with multiple roots
【Python】 已解决:ValueError: document with multiple roots
29 0
‘;‘ expected,Missing semicolon.Syntax Missing semicolon multi (web,若依定义方法,修改method,之后在mounted()用this
‘;‘ expected,Missing semicolon.Syntax Missing semicolon multi (web,若依定义方法,修改method,之后在mounted()用this
|
9月前
|
Kubernetes Python 微服务
Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding
Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding
80 0
|
PyTorch 算法框架/工具 Python
AttributeError: module ‘distutils‘ has no attribute ‘version‘解决跑pytorch代码报错
AttributeError: module ‘distutils‘ has no attribute ‘version‘解决跑pytorch代码报错
pip安装skbuild报错:ModuleNotFoundError: No module named ‘skbuild’解决方法
pip安装skbuild报错:ModuleNotFoundError: No module named ‘skbuild’解决方法,换源
708 0
【已解决!】ImportError: cannot import name ‘ProjectModelSerializer‘ from partially initialized module ‘pr
【已解决!】ImportError: cannot import name ‘ProjectModelSerializer‘ from partially initialized module ‘pr
解决办法:ImportError: 'module' object has no attribute 'check_specifier'
解决办法:ImportError: 'module' object has no attribute 'check_specifier'
119 0