matplotlib '_cext' -导入OrbitalPy时无此类模块

huus2vyu  于 2023-04-21  发布在  其他
关注(0)|答案(1)|浏览(343)

我使用OrbitalPy库在Python中显示轨道。
然而,当我运行程序时(实际上在OrbitalPy的文档/示例中列出):

from numpy import radians
from scipy.constants import kilo

from orbital import earth, KeplerianElements, Maneuver, plot, plot3d

from orbital import earth_sidereal_day
molniya = KeplerianElements.with_period(
    earth_sidereal_day / 2, e=0.741, i=radians(63.4), arg_pe=radians(270),
    body=earth)

plot3d(molniya)

我得到以下错误:

C:\Users\xxx\Desktop>py molniya.py
Traceback (most recent call last):
  File "C:\Users\xxx\Desktop\molniya.py", line 4, in <module>
    from orbital import earth, KeplerianElements, Maneuver, plot, plot3d
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\orbital\__init__.py", line 8, in <module>
    from .plotting import *
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\orbital\plotting.py", line 9, in <module>
    import matplotlib as mpl
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 246, in <module>
    _check_versions()
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 240, in _check_versions
    module = importlib.import_module(modname)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\kiwisolver\__init__.py", line 8, in <module>
    from ._cext import (
ImportError: DLL load failed while importing _cext: The specified module could not be found.

我已经尝试过重新安装matplotlib和kiwisolver,但没有任何帮助,甚至在google上搜索这个问题也没有任何结果。

sq1bmfud

sq1bmfud1#

我也有同样的问题。
这个问题的解决办法是:
Matplotlib kiwisolver import problem _cext
解决方案是运行:

pip install msvc-runtime

相关问题