Python导入错误+DLL加载失败+搜索路径

2024-10-02 20:37:14 发布

您现在位置:Python中文网/ 问答频道 /正文

在python2.7.10anaconda 2.3.0(64位)中,如果我写

sys.path.append('C:\\Anaconda\\sms-tools-master\\software\\models\\utilFunctions_C\\')
print sys.path

我明白了

C:\Anaconda\sms tools master\workspace\A1>;python A1Part1.py ['C:\Anaconda\sms tools master\workspace\A1','C:\Anaconda\python27.zip', 'C:\Anaconda\dll','C:\Anaconda\lib','C:\Anaconda\lib\plat win','C:\A naconda\lib\lib tk','C:\Anaconda','C:\Anaconda\lib\site packages','C:\ Anaconda\lib\site packages\Sphinx-1.3.1-py2.7.egg','C:\Anaconda\lib\site- packages\cryptography-0.9.1-py2.7-win-amd64.egg','C:\Anaconda\lib\site pack ages\win32','C:\Anaconda\lib\site packages\win32\lib','C:\Anaconda\lib \站点包\Pythonwin','C:\Anaconda\lib\site packages\setuptools-17.1。 1-py2.7.egg','C:\Anaconda\sms tools master\software\models\utilFunctions\u C \']

  1. 这是绝对的添加方式吗系统路径对的?有没有相对的方法?在
  2. 在我写的下一行python代码中

    从utilFunctions\u C导入wavread

我立刻得到

ImportError: cannot import name wavread

如果我在cmd中运行代码,但是如果我在IDLE中运行代码,我会得到:

['C:\Anaconda\sms-tools-master\workspace\A1', 'C:\Python27\Lib\idlelib', 'C:\Windows\system32\python27.zip', 'C:\Python27\DLLs', 'C:\Python27\lib', 'C:\Python27\lib\plat-win', 'C:\Python27\lib\lib-tk', 'C:\Python27', 'C:\Python27\lib\site-packages', 'C:\Anaconda\sms-tools-master\software\models\utilFunctions_C\']

Traceback (most recent call last): File "C:\Anaconda\sms-tools-master\workspace\A1\A1Part1.py", line 8, in from utilFunctions_C import wavread ImportError: DLL load failed: %1 is not a valid Win32 application.

那么,为什么会有区别,以及如何解决这个问题呢?谢谢!在


Tags: mastereggmodelslibpackagesa1sitesoftware
1条回答
网友
1楼 · 发布于 2024-10-02 20:37:14

我评论道

from utilFunctions_C import wavread

并使用

^{pr2}$

现在我的代码没问题了。我发现了

utiLFunctions.wavread() is a wrapper that uses scipy.io.wavfile.read() and scales the data to floating point between -1 and 1. If you open up utilFunctions.py you will see that.

You can use scipy.io.wavfile.read as well, as long you scale the data correctly looking at the datatype in the wav file. Due to scaling, for wav files that store samples as int16, you will see that scipy.io.wavfile.read returns values will be 32767 times the values returned by utilFunctions.wavread

Lectures used the function to explain the process more explicitly. Once you have got it, you can use the wrapper utilFunctions.wavread for the rest of the course and in practical applications.

卷进 https://class.coursera.org/audio-002/forum/searchq=Cannot+import+name+wavread#15-state-query=wavread&15-state-page_num=1

更多细节。在

相关问题 更多 >