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。 任何建议都会非常感激? 谢谢。
I have following error when importing 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 _tkaggMy system python information is following: 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.orgI installed matplotlib- 1.4.1. and also have latest version of tk. Any suggestion will be greatly appreciate ? Thanks.
最满意答案
条件
在MacOS Yosemite上安装命令行工具
command line tool- sudo xcode select --install解
如果你没有安装它们,请安装pip,然后安装mathplotlib,numpy和scipy软件包
Install pip- sudo easy_install pip用自制软件安装GCC
使用首选库运行以下命令
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)Prerequisite
Install the command line tool in on MacOS Yosemite
command line tool- sudo xcode select --installSolution
Install the pip followed by the mathplotlib, numpy and scipy packages if you did not installed them
Install pip- sudo easy_install pipInstall GCC with homebrew
Run the following command with your preferred libraries
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)更多推荐
发布评论