5

我从安装 numpy

sudo apt-get install numpy

然后在python2.7中导入numpy

import numpy

我收到这个错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/usr/local/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/usr/local/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 4, in <module>
    from type_check import *
  File "/usr/local/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "/usr/local/lib/python2.7/dist-packages/numpy/core/__init__.py", line 45, in <module>
    from numpy.testing import Tester
  File "/usr/local/lib/python2.7/dist-packages/numpy/testing/__init__.py", line 8, in <module>
    from unittest import TestCase
ImportError: cannot import name TestCase

然后我删除了 Numpy 和 Scipy。然后再次从 github repo 安装。但我仍然得到同样的错误。请帮忙。

谢谢你。

4

1 回答 1

20

我怀疑您有一个名为的本地文件被unittest.py导入而不是标准模块。

于 2012-06-06T15:30:11.953 回答