首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >树莓派opencv导入numpy时出错,ImportError: Error importing numpy,该如何解决?

树莓派opencv导入numpy时出错,ImportError: Error importing numpy,该如何解决?

提问于 2024-02-17 01:49:21
回答 0关注 0查看 93

我在树莓派上使用opencv时需要导入numpy,在安装numpy时使用了以下命令:

代码语言:text
复制
pip3 install -U numpy -i https://pypi.tuna.tsinghua.edu.cn/simple/

但当我安装成功后常识运行

代码语言:text
复制
import numpy

代码语言:text
复制
import cv2 

我遇到了以下问题

代码语言:text
复制
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.9/site-packages/numpy/__init__.py", line 135, in <module>
    raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there

其中 numpy安装到了

代码语言:text
复制
/home/pi/.local/lib/python3.9/site-packages/numpy-1.26.4.dist-info/

这是默认安装的路径,我并没有更改,但是我查到的答案告诉我也许是路径出了问题,我需要将该目录删除并重新安装,我这样试过并没有用,numpy仍安装到了原来的地方,而且当我进入python导入numpy时仍然会报错,这应该怎么解决

回答

和开发者交流更多问题细节吧,去?写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
http://www.vxiaotou.com