2017-02-13 1 views
0

파이썬에서 3D 표면 플롯을 작성하려고합니다. 내가 읽은 바로는,이 표준 패키지 : 그러나mplot3d를 파이썬에서 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를 Sierra로 업데이트 한 후이 문제가 발생했습니다.

sudo pip install -U matplotlib 

이 내 문제를 해결했습니다.

관련 문제