我在我的Mac兩條蟒蛇,它們是蟒蛇3.4和2.7 我可以在Python 3.4導入matplotlib但我跑matplotlib進口,但pyplot無法導入
from matplotlib import pyplot
我得到的錯誤:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from matplotlib import pyplot
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/backend_bases.py", line 62, in <module>
import matplotlib.textpath as textpath
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/textpath.py", line 18, in <module>
from matplotlib.mathtext import MathTextParser
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/mathtext.py", line 63, in <module>
import matplotlib._png as _png
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/_png.so, 2): Library not loaded: libpng15.15.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/matplotlib/_png.so
Reason: image not found
我是初學者。有人能幫我弄清楚發生了什麼,我該怎麼辦?
我不能運行PIP 3卸載matplotlib由於這個錯誤: PermissionError:[錯誤13]許可被拒絕:「/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ matplotlib-1.5.dev1-py3.4-macosx-10.6-intel.egg/__ pycache __/pylab.cpython-34.pyc' – Elm662
Hey @Elham!我不幸在上面不能重新創建這個錯誤。你可以閱讀這個問題http://stackoverflow.com/questions/11708708/pip-and-virtualenv-wo-virtualenvwrapper-pip-install-package-name-gives-permi或者嘗試'pyvenv venv && cd venv && source bin /激活&& pip安裝matplotlib'並查看它是否在virtualenv中工作? –