ubuntu20.04 vscode上python程序无法导入numpy和cv2

解决办法:

1.通过pip list 检查是否已经安装了numpy和python-opencv, 未安装是无法使用的,使用sudo apt-get install numpy可以安装

2. 已经安装了numpy,则

打开设置

File->preference->setting, 搜索Interpreter, 找到Python: Default Interpreter Path的路进,看是否正确。我的是只有”python“

不对则改为自己的解释器路进。

我的是在“~/cv/cv/bin/python3.8”,更改即可。

User和Worksapce都改。我试了只改Workspace也可以。

你可能感兴趣的:(vscode,python,numpy)