0
我試圖在python中建立3d表面圖。從我讀過,這是標準的軟件包:在python中安裝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嗎?
非常感謝。
您是否嘗試了錯誤消息中的建議? '目錄'/ Users/ryansullivan/Library/Caches/pip'或其父目錄不屬於當前用戶,並且緩存輪已被禁用。檢查該目錄的權限和所有者。如果用sudo執行pip,則可能需要sudo的-H標誌.' – tom
嗨@tom - 我確實嘗試了這個建議,但無濟於事。它實際上導致相同的錯誤。 –
@tom你能解決嗎? –