2017-02-13 7 views
0

私はpythonで3Dサーフェスプロットを作成しようとしています。私が何を読んでから、これは標準パッケージです:mplot3dをpythonで3Dプロットにインストールするときのエラー

from mpl_toolkits.mplot3d import Axes3D

しかし、私は次のエラー受け取る:

ImportError: No module named mpl_toolkits.mplot3d

を。これは、インストールしようとしたとき、私はエラーメッセージですパッケージ:

Myname-MacBook-Pro:ex1 myname$ sudo pip install --upgrade matplotlib 
The directory '/Users/ryansullivan/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/ryansullivan/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 matplotlib 
    Downloading matplotlib-2.0.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (12.8MB) 
    100% |████████████████████████████████| 12.8MB 101kB/s 
Collecting pyparsing!=2.0.0,!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 (from matplotlib) 
    Downloading pyparsing-2.1.10-py2.py3-none-any.whl (56kB) 
    100% |████████████████████████████████| 61kB 4.6MB/s 
Collecting numpy>=1.7.1 (from matplotlib) 
    Downloading numpy-1.12.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.4MB) 
    100% |████████████████████████████████| 4.4MB 289kB/s 
Collecting functools32 (from matplotlib) 
    Downloading functools32-3.2.3-2.zip 
Collecting pytz (from matplotlib) 
    Downloading pytz-2016.10-py2.py3-none-any.whl (483kB) 
    100% |████████████████████████████████| 491kB 1.4MB/s 
Collecting six>=1.10 (from matplotlib) 
    Downloading six-1.10.0-py2.py3-none-any.whl 
Collecting cycler>=0.10 (from matplotlib) 
    Downloading cycler-0.10.0-py2.py3-none-any.whl 
Collecting subprocess32 (from matplotlib) 
    Downloading subprocess32-3.2.7.tar.gz (54kB) 
    100% |████████████████████████████████| 61kB 2.7MB/s 
Collecting python-dateutil (from matplotlib) 
    Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB) 
    100% |████████████████████████████████| 194kB 2.2MB/s 
Installing collected packages: pyparsing, numpy, functools32, pytz, six, cycler, subprocess32, python-dateutil, matplotlib 
    Found existing installation: pyparsing 2.0.1 
    DEPRECATION: Uninstalling a distutils installed project (pyparsing) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. 
    Uninstalling pyparsing-2.0.1: 
Exception: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run 
    prefix=options.prefix_path, 
    File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install 
    requirement.uninstall(auto_confirm=True) 
    File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall 
    paths_to_remove.remove(auto_confirm) 
    File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove 
    renames(path, new_path) 
    File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames 
    shutil.move(old, new) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move 
    copy2(src, real_dst) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2 
    copystat(src, dst) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat 
    os.chflags(dst, st.st_flags) 
OSError: [Errno 1] Operation not permitted: '/tmp/pip-YwsZp1-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pyparsing-2.0.1-py2.7.egg-info' 

私が間違っていることや、このエラーを回避する方法mplot3dをインストールできますか?

多くのありがとうございます。

+0

エラーメッセージでアドバイスを試しましたか? 'ディレクトリ/ Users/ryansullivan/Library/Caches/pip 'またはその親ディレクトリが現在のユーザによって所有されていないため、キャッシングホイールが無効になっています。そのディレクトリの権限と所有者を確認してください。 sudoでpipを実行している場合は、sudoの-Hフラグが必要な場合があります。 ' – tom

+0

こんにちは@tom - 私はその提案を無駄にしようとしました。実際には同じエラーが発生します。 –

+0

@tomあなたはそれを解決できましたか? –

答えて

0

MacOSをEl CapitanからSierraにアップデートした後、この問題が発生しました。

sudo pip install -U matplotlib 

解決済み。

関連する問題