python 3.85 通过pip install 安装好hmmlearn后, from hmmearn import hmm时报错:
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] ::
conda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import hmmlearn
>>> from hmmlearn import hmm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\anaconda3\lib\site-packages\hmmlearn\hmm.py", line 16, in <module
from .base import BaseHMM
File "D:\anaconda3\lib\site-packages\hmmlearn\base.py", line 11, in <modul
from . import _hmmc, _utils
ImportError: DLL load failed while importing _hmmc: 找不到指定的模块。
>>>
网上查了半天发现也没有特别好的解决方法, 尝试pip uninstall 后再重装,再重启,都不能解决. 最后怀疑是不是python 3.85版本的问题,或者是当前环境包太多有冲突造成的. 不过实在懒得逐项查找排除问题, 干脆就另建了一个Python 3.8.13的环境, 再次安装hmmlearn包后, 果然成功导入hmm模块:
Python 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 05:59:00) [MSC
v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import hmmlearn
>>> from hmmlearn import hmm
>>>
填个小坑, 分享给有需要的小伙伴, 谢赞...