在Ubuntu 14.04上设置caffe但在运行classify.py时遇到错误

时间:2016-01-23 08:01:54

标签: python ubuntu caffe

我使用https://github.com/BVLC/caffe/wiki/Ubuntu-14.04-VirtualBox-VM作为灵感,在安装了CUDA(没有驱动程序)的Ubuntu 14.04虚拟服务器上安装Caffe。我已经安装了所有必需的依赖项,并且一步一步地遵循了所有说明,但在我尝试测试安装时会收到以下错误。

关于步骤: "修改python / classify.py以添加--print_results选项"

我修改了classify.py中的代码,使其与官方的caffe分配相同。不确定这是否是造成问题的步骤,但我认为为了以防万一,我会添加额外的信息。

我得到的错误如下:

vagrant@vagrant-ubuntu-trusty-64:~/caffe$ sudo python python/classify.py --print_results examples/images/cat.jpg foo

libdc1394 error: Failed to initialize libdc1394
Traceback (most recent call last):
  File "python/classify.py", line 14, in <module>
    import caffe
  File "/home/vagrant/caffe/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/home/vagrant/caffe/python/caffe/pycaffe.py", line 15, in <module>
    import caffe.io
  File "/home/vagrant/caffe/python/caffe/io.py", line 2, in <module>
    import skimage.io
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/__init__.py", line 15, in <module>
    reset_plugins()
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 89, in reset_plugins
    _load_preferred_plugins()
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 69, in _load_preferred_plugins
    _set_plugin(p_type, preferred_plugins['all'])
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 81, in _set_plugin
    use_plugin(plugin, kind=plugin_type)
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 251, in use_plugin
    _load(name)
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 295, in _load
    fromlist=[modname])
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/_plugins/matplotlib_plugin.py", line 4, in <module>
    import matplotlib.pyplot as plt
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1131, in <module>
    rcParams = rc_params()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 975, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1100, in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url
    encoding = locale.getdefaultlocale()[1]
  File "/usr/lib/python2.7/locale.py", line 543, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

任何输入都将不胜感激。谢谢。

1 个答案:

答案 0 :(得分:0)

检查您当前的shell环境,这些变量:Sub GetAverage() Dim Rws As Long, Col As Integer, r As Range, FrNg As Range Set r = Range("A1") Rws = Cells.Find(what:="*", after:=r, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row Col = Cells.Find(what:="*", after:=r, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column Set FrNg = Range(Cells(Rws + 2, 1), Cells(Rws + 2, Col)) ' range A2 to last cell on sheet FrNg = "=AVERAGE(A2:A" & Rws & ")" FrNg.Value = FrNg.Value End Sub LC_ALLLC_CTYPELANG

LANGUAGE

可能第一行打印的行将包含其中一个等于&lt; UTF-8&#39;的变量。这是错误的。

正确的区域设置应该包含语言和可选的国家/地区和编码规范,例如&#39; en&#39;或者&#39; en_US&#39;或者&#39; ru_RU.UTF-8&#39;。这是一个特殊的语言环境&#39; C&#39;用作后备。

因此,您可以在set | grep -a '^LC_ALL=.'; set | grep -a '^LC_CTYPE=.'; set | grep -a '^LANG=.'; set | grep -a '^LANGUAGE=.' 中永久重新定义您的语言区域(不要忘记重新加载您的设置,最简单的方法是注销/登录),或者只是为特定命令覆盖它:

/etc/default/locale

关于libdc1394:如果您不需要与FireWire交互,请检查ctypes error: libdc1394 error: Failed to initialize libdc1394