numpy安装中缺少numpy.distutils,theano尝试使用它

时间:2017-02-05 21:08:52

标签: python numpy docker theano

我正在尝试使用Theano和Lasagne构建Docker镜像。这些是主要步骤:

FROM nvidia/cuda:8.0-cudnn5-devel
RUN apt-get install -y libopenblas-dev python-dev python-pip
RUN pip install --upgrade pip
RUN pip install nose numpy scipy pandas h5py scikit-image scikit-learn jupyter
RUN pip freeze > requirements.txt && pip install -r requirements.txt --upgrade && rm requirements.txt
RUN pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
RUN pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

当图像准备好后,我启动它并尝试通过简单地在ipython中导入theano来测试theano。我收到以下错误(结束):

/usr/local/lib/python2.7/dist-packages/theano/gof/cmodule.pyc in std_include_dirs()
   1579
   1580 def std_include_dirs():
-> 1581     numpy_inc_dirs = np.distutils.misc_util.get_numpy_include_dirs()
   1582     py_inc = distutils.sysconfig.get_python_inc()
   1583     py_plat_spec_inc = distutils.sysconfig.get_python_inc(plat_specific=True)

AttributeError: 'module' object has no attribute 'distutils'

根据pip安装的版本是:numpy(1.12.0)和Theano(0.9.0b1)。我有另一个图像,由于某种原因。 numpy.distutils也不存在,但Theano不会尝试在import theano命令上调用它。

  1. 为什么numpy.distutils安装了numpy
  2. 为什么Theano会尝试使用它?
  3. 最重要的是:我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

安装https://github.com/Theano/Theano/archive/master.zip会为您提供该库的测试版,并且它似乎无法为每个系统正常运行。

除非您绝对需要Theano 0.9中的某些功能,否则我建议您从pip自己的存储库进行安装。可能对Lasagne执行相同的操作。

RUN pip install theano lasagne