Python多处理池,OSError:Errno 2没有这样的文件或目录

问题描述:

我试图用这个github回购做一些鸟鸣分析。我在收集所有样本到一个数组的阶段遇到了问题('Collect Samples')。我遇到了一个看起来与我的系统有关的错误。不知道从哪里开始修复错误。 (看看我的链接github回购得到更多的深入。)感谢您的看看!Python多处理池,OSError:Errno 2没有这样的文件或目录

def job(fn): 
    return load_sample(fn, sr=sr, 
         max_length=max_length, fixed_length=fixed_length) 
pool = Pool() 
%time results = pool.map(job, files[:limit]) 
print 'Processed', len(results), 'samples' 


    --------------------------------------------------------------------------- 
OSError         Traceback (most recent call last) 
<ipython-input-8-5d12f8de2a12> in <module>() 
     3      max_length=max_length, fixed_length=fixed_length) 
     4 pool = Pool() 
----> 5 get_ipython().magic(u'time results = pool.map(job, files[:limit])') 
     6 print 'Processed', len(results), 'samples' 

/home/notebook/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s) 
    2156   magic_name, _, magic_arg_s = arg_s.partition(' ') 
    2157   magic_name = magic_name.lstrip(prefilter.ESC_MAGIC) 
-> 2158   return self.run_line_magic(magic_name, magic_arg_s) 
    2159 
    2160  #------------------------------------------------------------------------- 

/home/notebook/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line) 
    2077     kwargs['local_ns'] = sys._getframe(stack_depth).f_locals 
    2078    with self.builtin_trap: 
-> 2079     result = fn(*args,**kwargs) 
    2080    return result 
    2081 

<decorator-gen-59> in time(self, line, cell, local_ns) 

/home/notebook/anaconda2/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k) 
    186  # but it's overkill for just that one bit of state. 
    187  def magic_deco(arg): 
--> 188   call = lambda f, *a, **k: f(*a, **k) 
    189 
    190   if callable(arg): 

/home/notebook/anaconda2/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns) 
    1183   else: 
    1184    st = clock2() 
-> 1185    exec(code, glob, local_ns) 
    1186    end = clock2() 
    1187    out = None 

<timed exec> in <module>() 

/home/notebook/anaconda2/lib/python2.7/multiprocessing/pool.pyc in map(self, func, iterable, chunksize) 
    249   ''' 
    250   assert self._state == RUN 
--> 251   return self.map_async(func, iterable, chunksize).get() 
    252 
    253  def imap(self, func, iterable, chunksize=1): 

/home/notebook/anaconda2/lib/python2.7/multiprocessing/pool.pyc in get(self, timeout) 
    565    return self._value 
    566   else: 
--> 567    raise self._value 
    568 
    569  def _set(self, i, obj): 

OSError: [Errno 2] No such file or directory 

此外,万一它有帮助,我运行Python 2.7.13 | Anaconda 4.4.0。

哦,导致该错误是results = pool.map(job, files[:limit])

感谢很多提前行。

+0

https://github.com/worldveil/dejavu/issues/36可能是这个问题,因为我一直有安装ffmpeg的实际问题 –

下我的意见后,我贴我尝试安装的ffmpeg使用

sudo apt-get install libav-tools

从这个link。 不知道如何安装ffmpeg,但它解决了问题!

如果我应该删除这篇文章请告诉我,但我认为这对其他类似问题的人有用。即。如果您遇到类似问题,则无需了解映射器和池。