没有名为 soundfile 的模块

the*_*sti 5 python pip python-2.x

每当我尝试导入时soundfile都会收到错误

\n
ImportError: No module named soundfile\n
Run Code Online (Sandbox Code Playgroud)\n

我安装 pysoundfile 似乎没有遇到任何问题:

\n
$ sudo pip install pysoundfile\nThe directory '~/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.\nThe directory '~/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.\nCollecting pysoundfile\n  Downloading PySoundFile-0.9.0.post1-py2.py3.cp26.cp27.cp32.cp33.cp34.cp35.cp36.pp27.pp32.pp33-none-macosx_10_5_x86_64.macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl (573kB)\n    100% |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 573kB 430kB/s\nRequirement already satisfied: cffi>=0.6 in /Library/Python/2.7/site-packages (from pysoundfile)\nRequirement already satisfied: pycparser in /Library/Python/2.7/site-packages (from cffi>=0.6->pysoundfile)\nInstalling collected packages: pysoundfile\nSuccessfully installed pysoundfile-0.9.0.post1\n
Run Code Online (Sandbox Code Playgroud)\n

那么是什么导致了这个问题呢?

\n

cha*_*ter 2

检查测试环境是否安装

示例方法

$ pip install virtualenv
$ python -m virtualenv venv
$ source venv/bin/activate
$ pip install pysoundfile
$ python
>>> import soundfile
Run Code Online (Sandbox Code Playgroud)