[英]Error when running django-admin in command line “ModuleNotFoundError: No module named 'asyncio.base_events'”
Created the virtual env with pyenv使用 pyenv 创建虚拟环境
pyenv init
pyenv shell 3.9.0
python -m venv name_of_venv
Installed Django through pip in a virtual env: pip install Django==3.1.7
在虚拟环境中安装 Django 到 pip: pip install Django==3.1.7
Then when I run django-admin
in cmd line I get the following error:然后,当我在 cmd 行中运行django-admin
时,出现以下错误:
File "/Users/sushensatturu/envs/excel/bin/django-admin", line 5, in <module>
from django.core.management import execute_from_command_line
File "/Users/sushensatturu/envs/excel/lib/python3.9/site-packages/django/core/management/__init__.py", line 12, in <module>
from django.conf import settings
File "/Users/sushensatturu/envs/excel/lib/python3.9/site-packages/django/conf/__init__.py", line 19, in <module>
from django.utils.deprecation import RemovedInDjango40Warning
File "/Users/sushensatturu/envs/excel/lib/python3.9/site-packages/django/utils/deprecation.py", line 1, in <module>
import asyncio
File "/Users/sushensatturu/.pyenv/versions/3.9.0/lib/python3.9/asyncio/__init__.py", line 8, in <module>
from .base_events import *
Fixed:固定的:
Just had to uninstall and reinstall the python version through pyenv, then create a new virtial environment只需要通过pyenv卸载并重新安装python版本,然后创建一个新的虚拟环境
Eg.例如。
pyenv uninstall 3.9.0
pyenv install 3.9.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.