我正在尝试导入pyLDAvis,但它给出了错误ModuleNotFoundError:尽管我同时安装了pyLDAvis和contextvars,但没有名为“ _contextvars”的模块。错误如下
Traceback (most recent call last):
File "C:/Users/ebru/Documents/Arda Docs/Mydocs/ITLS/Research/Tüpraş/Python Codes/Tupras_NLPv04.py", line 249, in <module>
import pyLDAvis
File "C:\Users\ebru\PycharmProjects\Tuprasv01\venv\lib\site-packages\pyLDAvis\__init__.py", line 44, in <module>
from ._display import *
File "C:\Users\ebru\PycharmProjects\Tuprasv01\venv\lib\site-packages\pyLDAvis\_display.py", line 7, in <module>
import jinja2
File "C:\Users\ebru\PycharmProjects\Tuprasv01\venv\lib\site-packages\jinja2\__init__.py", line 82, in <module>
_patch_async()
File "C:\Users\ebru\PycharmProjects\Tuprasv01\venv\lib\site-packages\jinja2\__init__.py", line 78, in _patch_async
from jinja2.asyncsupport import patch_all
File "C:\Users\ebru\PycharmProjects\Tuprasv01\venv\lib\site-packages\jinja2\asyncsupport.py", line 13, in <module>
import asyncio
File "C:\Users\ebru\AppData\Local\Programs\Python\Python37-32\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\Users\ebru\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 39, in <module>
from . import events
File "C:\Users\ebru\AppData\Local\Programs\Python\Python37-32\lib\asyncio\events.py", line 14, in <module>
import contextvars
File "C:\Users\ebru\AppData\Local\Programs\Python\Python37-32\lib\contextvars.py", line 1, in <module>
from _contextvars import Context, ContextVar, Token, copy_context
ModuleNotFoundError: No module named '_contextvars'
我试图删除contextvars.py中的下划线,但没有用。
import pyLDAvis
import pyLDAvis.sklearn
答案 0 :(得分:0)
根据https://github.com/axnsan12/drf-yasg/issues/362#issuecomment-494360308,此问题可能是由于virtualenv未升级到已安装的Python版本所致。
此外,3.7.4已发布并包含与上下文变量有关的更改。也许升级到那个有帮助吗?