Matplotlib/Pylab 安装问题,无法在 _tkagg 中导入?
Matplotlib/Pylab installation issue and can not import in _tkagg?
导入pylab时出现以下错误。
>>> import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pylab.py", line 274, in <module>
from matplotlib.pyplot import *
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pyplot.py", line 109, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/backend_tkagg.py", line 13, in <module>
import matplotlib.backends.tkagg as tkagg
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/tkagg.py", line 7, in <module>
from matplotlib.backends import _tkagg
ImportError: cannot import name _tkagg
我的系统python信息如下:
OS- Mac OS X Yosemite
Python 2.7.9 |Anaconda 1.6.1 (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
我安装了 matplotlib- 1.4.1. 并且还有最新版本的 tk。
任何建议将不胜感激?谢谢。
先决条件
在 MacOS Yosemite
中安装 命令行工具
command line tool- sudo xcode select --install
解决方案
安装 pip,然后安装 mathplotlib、numpy 和 scipy 软件包(如果您没有安装它们)
Install pip- sudo easy_install pip
安装 GCC 和 homebrew
运行 使用您的首选库执行以下命令
Install matplotlib- sudo pip install -U matplotlib
Install numpy- sudo pip install -U numpy (can ignore if you already installed)
Install scipy- sudo pip install -U scipy (can ignore if you already installed)
导入pylab时出现以下错误。
>>> import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pylab.py", line 274, in <module>
from matplotlib.pyplot import *
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pyplot.py", line 109, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/backend_tkagg.py", line 13, in <module>
import matplotlib.backends.tkagg as tkagg
File "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/tkagg.py", line 7, in <module>
from matplotlib.backends import _tkagg
ImportError: cannot import name _tkagg
我的系统python信息如下: OS- Mac OS X Yosemite
Python 2.7.9 |Anaconda 1.6.1 (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
我安装了 matplotlib- 1.4.1. 并且还有最新版本的 tk。 任何建议将不胜感激?谢谢。
先决条件
在 MacOS Yosemite
中安装 命令行工具command line tool- sudo xcode select --install
解决方案
安装 pip,然后安装 mathplotlib、numpy 和 scipy 软件包(如果您没有安装它们)
Install pip- sudo easy_install pip
安装 GCC 和 homebrew
运行 使用您的首选库执行以下命令
Install matplotlib- sudo pip install -U matplotlib
Install numpy- sudo pip install -U numpy (can ignore if you already installed)
Install scipy- sudo pip install -U scipy (can ignore if you already installed)