在pycharm中导入Numpy和cv2错误

时间:2015-05-20 19:21:17

标签: python python-2.7 opencv numpy pycharm

我正在尝试在Pycharm社区版4.5中设置theano。我正在研究ubuntu 12.04。 我有两个问题,

1) import numpy gives error, although when i check project interpreter i see numpy installed.
2) import cv2; (this is underlined with red line).

pycharm控制台上的错误如下:

Traceback (most recent call last):
File "/afs/cs.stanford.edu/u/ihsan/Documents/pycharm-community-4.5/helpers /pydev/pydevd.py", line 2357, in <module> 
 globals = debugger.run(setup['file'], None, None, is_module)
 File "/afs/cs.stanford.edu/u/ihsan/Documents/pycharm-community-4.5/helpers/pydev/pydevd.py", line 1777, in run
 pydev_imports.execfile(file, globals, locals)  # execute the script
 File "/scr/Ihsan/22-april-code/my_convolutional_mlp_2.py", line 29, in <module>
 import numpy
 File "/afs/cs.stanford.edu/u/ihsan/Documents/pycharm-community-4.5/helpers/pydev/pydev_monkey_qt.py", line 71, in patched_import
 return original_import(name, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 170, in <module>
  from . import add_newdocs
File "/afs/cs.stanford.edu/u/ihsan/Documents/pycharm-community-4.5/helpers/pydev/pydev_monkey_qt.py", line 71, in patched_import
 return original_import(name, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/afs/cs.stanford.edu/u/ihsan/Documents/pycharm-community-4.5/helpers/pydev/pydev_monkey_qt.py", line 71, in patched_import
  return original_import(name, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 17, in <module> 
  from . import scimath as emath
ImportError: cannot import name scimath

Process finished with exit code 1

但我的第一个问题是numpy,它会因为导入numpy而停止,并且不会更进一步。 有任何线索如何解决?

1 个答案:

答案 0 :(得分:-1)

我不知道你有多少使用Python的经验,很抱歉,如果我的答案太简单了,你是否尝试过键入

来安装scimath
pip install scimath

在控制台/终端?