Matplotlib / Pylab安装问题并不能导入

编程入门 行业动态 更新时间:2024-10-25 21:28:03
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 _tkagg

My 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.org

I 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 --install

Solution

Install the pip followed by the mathplotlib, numpy and scipy packages if you did not installed them

Install pip- sudo easy_install pip

Install 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)

更多推荐

本文发布于:2023-07-31 08:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1341924.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:并不能   Matplotlib   Pylab

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!