英文:
'_cext' - no such module when importing OrbitalPy
问题
我在Python中使用OrbitalPy库来显示轨道。
然而,当我运行程序(实际上是在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,但没有帮助。甚至在谷歌搜索中也没有找到关于这个问题的任何结果。
英文:
I'm using the OrbitalPy lib to display orbits in Python.
However, when I run the program (which is actually listed in the docs/examples of 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)
I get the following errors:
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.
I already tried reinstalling matplotlib and kiwisolver, but nothing helped. Even a google search didn't give me any results for this issue.
答案1
得分: 1
我遇到了同样的问题。
解决方案可以在这个问题中找到:
Matplotlib kiwisolver import problem _cext
解决方案只是运行:
pip install msvc-runtime
英文:
I had the same problem.
the solution is found on this question:
Matplotlib kiwisolver import problem _cext
The solution is just to run:
pip install msvc-runtime
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论