虚拟环境启动I报错
Traceback (most recent call last): File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker worker.init_process() File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/workers/ggevent.py", line 146, in init_process super().init_process() File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi() File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp return util.import_app(self.app_uri) File "/data/.virtualenvs/cmdb/lib/python3.7/site-packages/gunicorn/util.py", line 359, in import_app mod = importlib.import_module(module) File "/usr/local/python3/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/mytestproject/mytestproject/__init__.py", line 2, in <module> from .celery import app as celery_app File "/home/mytestproject/mytestproject/celery.py", line 2, in <module> from celery import Celery ImportError: cannot import name 'Celery' from 'celery' (/data/.virtualenvs/cmdb/lib/python3.7/site-packages/celery/__init__.py)
处理办法:
pip install importlib-metadata==4.13.0
标签:load,py,Django,celery,python3.7,报错,File,import,line From: https://www.cnblogs.com/jiaosf/p/16810129.html