我尝试使用astropy
和pycraf
进行单位转换,但是当我尝试使用import pycraf
时却收到错误消息ImportError: DLL load failed: The specified module could not be found.
。它似乎来自scipy
,但我可以import scipy
很好。我正在Windows 10上使用Python 3.6.8 :: Anaconda custom (64-bit)
。感谢您的宝贵时间。
WARNING: AstropyDeprecationWarning: astropy.utils.compat.funcsigs is now deprecated - use inspect instead [astropy.utils.compat.funcsigs]
Traceback (most recent call last):
File ".\spectrum.py", line 2, in <module>
import pycraf.conversions as cnv
File "C:\ProgramData\Anaconda3\lib\site-packages\pycraf\__init__.py", line 38, in <module>
from . import pathprof
File "C:\ProgramData\Anaconda3\lib\site-packages\pycraf\pathprof\__init__.py", line 11, in <module>
from .cyprop import *
File "pycraf/pathprof/cyprop.pyx", line 23, in init pycraf.pathprof.cyprop
File "C:\ProgramData\Anaconda3\lib\site-packages\pycraf\pathprof\heightprofile.py", line 11, in <module>
from . import srtm
File "C:\ProgramData\Anaconda3\lib\site-packages\pycraf\pathprof\srtm.py", line 37, in <module>
from scipy.interpolate import RegularGridInterpolator, RectBivariateSpline
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\interpolate\__init__.py", line 175, in <module>
from .interpolate import *
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\interpolate\interpolate.py", line 21, in <module>
import scipy.special as spec
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\special\__init__.py", line 641, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
这是我非常简单的文件。
import astropy.units as u
import pycraf.conversions as cnv
power = 1 * u.W
print('{:.2f}'.format(power))
# 1.00 W
print('{:.2f}'.format(power.to(cnv.dB_W)))
# 0.00 dB(W)
print('{:.2f}'.format(power.to(cnv.dBm)))