Python 没有名为soundfile的模块
每当我尝试导入Python 没有名为soundfile的模块,python,pip,python-2.x,Python,Pip,Python 2.x,每当我尝试导入soundfile时,都会出现错误 ImportError: No module named soundfile 我安装pysoundfile似乎没有问题: $ sudo pip install pysoundfile The directory '/Users/theonlygusti/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache h
soundfile
时,都会出现错误
ImportError: No module named soundfile
我安装pysoundfile似乎没有问题:
$ sudo pip install pysoundfile
The directory '/Users/theonlygusti/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.
The directory '/Users/theonlygusti/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.
Collecting pysoundfile
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)
100% |████████████████████████████████| 573kB 430kB/s
Requirement already satisfied: cffi>=0.6 in /Library/Python/2.7/site-packages (from pysoundfile)
Requirement already satisfied: pycparser in /Library/Python/2.7/site-packages (from cffi>=0.6->pysoundfile)
Installing collected packages: pysoundfile
Successfully installed pysoundfile-0.9.0.post1
那么是什么导致了这个问题呢?检查它是否安装在测试环境中 示例方法
$ pip install virtualenv
$ python -m virtualenv venv
$ source venv/bin/activate
$ pip install pysoundfile
$ python
>>> import soundfile
检查它是否安装在测试环境中 示例方法
$ pip install virtualenv
$ python -m virtualenv venv
$ source venv/bin/activate
$ pip install pysoundfile
$ python
>>> import soundfile
PySoundFile依赖于Python包CFFI和NumPy,以及系统库libsndfile 要安装Python依赖项,我建议使用Python 3的Anaconda发行版 这将附带预安装的所有依赖项。要手动安装依赖项,可以使用conda软件包管理器,该软件包管理器将使用
conda install cffi numpy
安装所有依赖项(conda也可独立于Anaconda withpip install conda
)
安装了CFFI和NumPy后,您可以使用
pip install pysoundfile
下载并安装最新版本的pysoundfile。在Windows和OS X上,这还将安装库libsndfile。在Linux上,您需要使用发行版的包管理器安装libsndfile,例如sudo apt get install libsndfile1
PySoundFile取决于Python包CFFI和NumPy以及系统库libsndfile
要安装Python依赖项,我建议使用Python 3的Anaconda发行版
这将附带预安装的所有依赖项。要手动安装依赖项,可以使用conda软件包管理器,该软件包管理器将使用conda install cffi numpy
安装所有依赖项(conda也可独立于Anaconda withpip install conda
)
安装了CFFI和NumPy后,您可以使用
pip install pysoundfile
下载并安装最新版本的pysoundfile。在Windows和OS X上,这还将安装库libsndfile。在Linux上,您需要使用发行版的包管理器安装libsndfile,例如sudo apt get install libsndfile1
我也遇到了同样的问题,我想问题出在python版本上。当我尝试使用Python 3.5.2时
相反,我在Python2.7.12中尝试了同样的方法
它成功地导入了它 我也遇到了同样的问题,我想问题出在python版本上。当我尝试使用Python 3.5.2时 相反,我在Python2.7.12中尝试了同样的方法
它成功地导入了它 用于谷歌Colab研究 复制粘贴这个
!pip install soundfile
&然后导入它
import soundfile
谷歌Colab研究中心 复制粘贴这个
!pip install soundfile
&然后导入它
import soundfile
您使用的
python
可执行文件是否与您使用的pip
executabel匹配?默认情况下,用于python2.7的pip安装包。你在使用Python 2.7吗?@Evert我在这两个版本上运行了,得到了/usr/local/bin/Python
和/usr/local/bin/pip
。不确定如何检查sudo
是否相同,但运行sudo返回相同的结果。但这可能不是正确的诊断方法。@HonzaSedloňPython 2.7.13,pip 9.0.1搜索模块文件(使用查找)。然后查看祖先库路径是否包含在sys.path
中。您正在使用的python
可执行文件是否与您正在使用的pip
executabel匹配?默认情况下,用于python 2.7的pip安装包。你在使用Python 2.7吗?@Evert我在这两个版本上运行了,得到了/usr/local/bin/Python
和/usr/local/bin/pip
。不确定如何检查sudo
是否相同,但运行sudo返回相同的结果。但这可能不是正确的诊断方法。@HonzaSedloňPython 2.7.13,pip 9.0.1搜索模块文件(使用查找)。然后查看祖先库路径是否包含在sys.path