在安装 theano 期间没有名为 nose_parameterized 的模块

`No module named nose_parameterized` during theano installation

目前我正在尝试在我的 ubuntu 16.04 系统上安装 theano 并支持 cuda。安装过程本身进行得很顺利,直到我尝试测试安装:

python -c "import theano; theano.test()"

输出的最后几行是:

======================================================================
ERROR: Failure: ImportError (No module named nose_parameterized)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/theano/tests/test_rop.py", line 16, in <module>
    from theano.tests import unittest_tools as utt
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/theano/tests/unittest_tools.py", line 7, in <module>
    from nose_parameterized import parameterized
ImportError: No module named nose_parameterized

----------------------------------------------------------------------
Ran 408 tests in 13.085s

FAILED (SKIP=26, errors=80)

这些之前有大约 20 个块,似乎是不同的测试在堆栈跟踪中完全相同的前 3 行失败。最后出现的代码如下所示(添加了行号):

411. # FIXME: to support module.name names,
412. # do what resolve-name does and keep trying to
413. # import, popping tail of module into addr.call,
414. # until we either get an import or run out of
415. # module parts
416. try:
417.     module = self.importer.importFromPath(
418.     addr.filename, addr.module)
419. finally:
420.     self.config.plugins.afterImport(
421.     addr.filename, addr.module)

在寻找解决方案时,我遇到了:

我尝试了那里提出的解决方案:
sudo pip install nose-parameterized
然而,这没有效果。有谁知道还有什么可能导致此错误?

编辑:所以我重新安装了 theano 以使问题更容易重现。我使用 here 中的说明安装了 theano,所以我使用了:

sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git  
sudo pip install Theano  

然后我用了:

nosetests theano

这个输出的最后几行和前面几乎一样:

======================================================================
ERROR: Failure: ImportError (No module named nose_parameterized)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/myUser/.local/lib/python2.7/site-packages/theano/tests/test_rop.py", line 16, in <module>
    from theano.tests import unittest_tools as utt
  File "/home/myUser/.local/lib/python2.7/site-packages/theano/tests/unittest_tools.py", line 7, in <module>
    from nose_parameterized import parameterized
ImportError: No module named nose_parameterized

----------------------------------------------------------------------
Ran 457 tests in 160.608s

FAILED (SKIP=24, errors=95)

编辑 2:我认为这可能是 python 版本问题。当我尝试时:

python -V  

我得到:

Python 2.7.12 :: Anaconda 4.2.0 (64-bit)

并且存在以下文件夹:
/usr/local/lib/python2.7/dist-packages/nose_parameterized
所以,据我所知,这应该不是问题。但是当我尝试时:

python2.7 -c "import nose_parameterized"  

我得到:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named nose_parameterized

发现问题,anaconda 正在自己的文件夹中查找。所以为了解决,我做了:
conda install nose-parameterized

以下对我有用:

pip install nose-parameterized