2017-08-16 8 views
1

私は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 

ので、何がこの問題を引き起こしていますか?それは、テスト環境にインストールされている場合

+1

使用している 'python'実行可能ファイルは、使用している' pip'実行ファイルと一致していますか? – Evert

+0

python 2.7用のデフォルトインストールパッケージをインストールします。あなたはusinh Python 2.7ですか? –

+0

@Evert私は '/ usr/local/bin/python'と'/usr/local/bin/pip'を持っています。 'sudo'と同じであるかどうかを確認する方法は不明ですが、' sudo which'を実行しても同じ結果を返します。それは診断する正しい方法ではないかもしれません。 – theonlygusti

答えて

0

チェック

例ウェイズ

$ pip install virtualenv 
$ python -m virtualenv venv 
$ source venv/bin/activate 
$ pip install pysoundfile 
$ python 
>>> import soundfile 
2

PySoundFileはPythonパッケージのCFFIとnumpyの、およびシステムライブラリLibsndfileが異なります。 Pythonの依存関係をインストールするには

、私はこれは、すべての依存関係プリインストールされていますPythonの3

のアナコンダ分布を使用することをお勧めします。依存関係を手動でインストールするには、condaパッケージマネージャを使用します。これは、conda install cffi numpy(condaはAnacondaとは独立してpip install condaで利用可能です)を使用してすべての依存関係をインストールします。

CFFIとNumPyがインストールされている場合は、pip install pysoundfileを使用してPySoundFileの最新リリースをダウンロードしてインストールできます。 WindowsおよびOS Xでは、libsndfileライブラリもインストールされます。 Linuxでは、ディストリビューションのパッケージマネージャを使用してlibsndfileをインストールする必要があります(例:sudo apt-get install libsndfile1)。

0

私は同じ問題を抱えていましたが、問題はPythonのバージョンにあると思います。私は、Python 3.5.2

python3 file_name.py 
ImportError: No module named 'soundfile' 

を試みたときに代わりに、私はそれが正常にインポートされたPythonの2.7.12

python file_name.py 

を同じことを試してみました!

関連する問題