原标题:MPLCONFIGDIR .matplotlib not writeable on matplotlib import
我正在运行 pylearn2 的教程,但在导入matplotlib.pyplot
. 一些可能不必要的信息是我在 Vagrant 生成的 VirtualBox 中运行它。我已经看到了几个类似的错误,都是关于 django 的,但我没有尝试虚拟主机,也没有空间不足。我试过以 root 身份运行 python,虽然不安全,但它仍然不起作用。我也试过用同样的错误设置我的 MPLCONFIGDIR 变量。如果我可以提供更多信息,请告诉我。谢谢。
Traceback (most recent call last):
File "/home/vagrant/pylearn2/pylearn2/scripts/plot_monitor.py", line 274, in <module>
main()
File "/home/vagrant/pylearn2/pylearn2/scripts/plot_monitor.py", line 57, in main
import matplotlib.pyplot as plt
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 774, in <module>
rcParams = rc_params()
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 692, in rc_params
fname = matplotlib_fname()
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 604, in matplotlib_fname
fname = os.path.join(get_configdir(), 'matplotlibrc')
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 253, in wrapper
ret = func(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 475, in _get_configdir
raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h))
RuntimeError: '/home/vagrant' is not a writable dir; you must set /home/vagrant/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored
/home/vagrant 是我的主目录,所以它是可写的,但对于有关...
vagrant@precise64:~$ ls -ld /home/vagrant
drwxrwxrwx 1 vagrant vagrant 16384 Sep 26 17:40 /home/vagrant
vagrant@precise64:~$ ls -ld /home/vagrant/.matplotlib/
drwxrwxrwx 1 vagrant vagrant 4096 Sep 26 18:07 /home/vagrant/.matplotlib/
更新:
这似乎是由
OSError: [Errno 26] Text file busy: '/home/vagrant/.matplotlib/tmp3ciLMo'
我怀疑这与 vagrant 将我的主文件夹安装为 synced_folder 有关