Matplotlib在Ubuntu 14.04上需要sudo

Matplotlib在Ubuntu 14.04上需要sudo,第1张

概述Matplotlib在Ubuntu 14.04上需要sudo

我最近转移到一台新的笔记本电脑。 在安装了Ubuntu 14.04 LTS和我以前的系统包含的所有软件包之后,我将我的旧系统中的所有文件复制到新系统。

每当我尝试执行任何有matplotlib调用的Python代码,我得到以下错误

file "Q1.py",line 2,in <module> import matplotlib.pyplot as plt file "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py",line 24,in <module> import matplotlib.colorbar file "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py",line 29,in <module> import matplotlib.collections as collections file "/usr/lib/pymodules/python2.7/matplotlib/collections.py",line 23,in <module> import matplotlib.backend_bases as backend_bases file "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py",line 50,in <module> import matplotlib.textpath as textpath file "/usr/lib/pymodules/python2.7/matplotlib/textpath.py",line 11,in <module> import matplotlib.Font_manager as Font_manager file "/usr/lib/pymodules/python2.7/matplotlib/Font_manager.py",line 1356,in <module> _rebuild() file "/usr/lib/pymodules/python2.7/matplotlib/Font_manager.py",line 1343,in _rebuild pickle_dump(FontManager,_fmcache) file "/usr/lib/pymodules/python2.7/matplotlib/Font_manager.py",line 939,in pickle_dump with open(filename,'wb') as fh: IOError: [Errno 2] No such file or directory: '/tmp/matplotlib-skarthikkrishna/FontList.cache'

从我已经能够尝试,这个问题似乎出现,因为代码不能访问/ tmp /写入它。 当我在执行命令之前添加一个sudo标签时,代码运行得很好。

我很好奇,为什么现在正在发生。 我的新旧笔记本电脑上的所有软件包,特别是pyplot软件包都是一样的。 我没有错过安装任何软件包,也没有任何更新没有反映在其中一个系统中。 我的旧笔记本电脑的代码运行得很好。 它拒绝没有sudo在新的工作。 如果有人能帮我解决这个问题,我会很感激的

draw_networkx_labels的可用“Font-family”条目

绘制和写入没有窗口的图像文件

如何在show()之后设置matplotlib图的tight_layout

无法构buildmatplotlib(png包问题)

ArcGIS 10.1和Python加载项

一些细节,如果它们是相关的:

这两个系统都运行Ubuntu 14.04 LTS,最后于2014年12月26日升级。

我在两个系统上运行Python 2.7.6。 [这是大部分课程的强制要求]

两个系统上安装的Matplotlib版本是1.3.1

编辑:

ls -ld / tmp /的输出是

drwxrwxrwt 4 root root 4096 Dec 27 18:45 /tmp/

ls -ld / tmp / matplotlib-skarthikkrishna的输出是

ls: cannot access /tmp/matplotlib-skarthikkrishna: No such file or directory

如果所有相关的话,输出和输出都保持不变。

importError:没有安装matplotlib的matplotlib模块

安装matplotlib-venn

matplotlib和wxpython的透明度问题

matplotlib – 在CentOS上安装 – setup.py版本失败

importError:没有名为“matplotlib.externals”的模块

这是解决方案,为我工作:

sudo rm -rf $HOME/.cache/matplotlib

感谢aberaud 在2015年7月14日评论

我有这个问题,通过删除$ HOME / .cache / matplotlib来修复它,这是由root拥有的。

总结

以上是内存溢出为你收集整理的Matplotlib在Ubuntu 14.04上需要sudo全部内容,希望文章能够帮你解决Matplotlib在Ubuntu 14.04上需要sudo所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1293813.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存