“cvxpy” 未被 Pylance 访问

huangapple go评论91阅读模式
英文:

"cvxpy" is not accessed Pylance

问题

I have successfully downloaded the module 'cvxpy', and I can import it in the terminal, but every time I try to import it in VsCode, it always tells 'ModuleNotFoundError: No module named 'cvxpy'. I am very sure I have downloaded it, and it also shows that '"cvxpy" is not accessed Pylance', how can I deal with this problem???

在终端中成功导入了模块'cvxpy',但每次尝试在VsCode中导入它时,都会出现'ModuleNotFoundError: No module named 'cvxpy''的错误。我非常确定我已经下载了它,而且还显示'"cvxpy" is not accessed Pylance',我该如何解决这个问题?

英文:

python==3.11.3
Macbook M1
I have successfully downloaded the module 'cvxpy', and I can import it in the terminal, but every time I try to import it in VsCode, it always tells 'ModuleNotFoundError: No module named 'cvxpy'. I am very sure I have downloaded it, and it also shows that '"cvxpy" is not accessed Pylance', how can I deal with this problem???

successfully import the module 'cvxpy' in VsCode

答案1

得分: 1

> ModuleNotFoundError: No module named 'cvxpy'

<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> --> Python: Select Interpreter --> 选择正确的解释器(安装了cvxoy的Python环境)。

“cvxpy” 未被 Pylance 访问

右下角显示当前工作区使用的Python版本,您也可以单击它进行切换

“cvxpy” 未被 Pylance 访问

> "cvxpy" is not accessed Pylance

这个警告意味着您还没有使用 cvxpy,这不是错误。如果您在随后的代码中使用了 cvxpy,这个警告会消失。

“cvxpy” 未被 Pylance 访问

“cvxpy” 未被 Pylance 访问

您可以看到它的阴影发生了变化。还有 Import &quot;cvxpy&quot; could not be resolved 的错误,因为我没有安装 cvxpy

英文:

> ModuleNotFoundError: No module named 'cvxpy'

<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> --> Python: Select Interpreter --> Select the correct interpreter (the python environment where cvxoy is installed).

“cvxpy” 未被 Pylance 访问

The lower right corner displays the python version being used in the current workspace, and you can also click it to switch

“cvxpy” 未被 Pylance 访问


> "cvxpy" is not accessed Pylance

This warning means that you are not using cvxpy yet, this is not an error. If you use cvxpy in subsequent code, the warning will disappear.

“cvxpy” 未被 Pylance 访问

“cvxpy” 未被 Pylance 访问

You can see it's shades change. There is also Import &quot;cvxpy&quot; could not be resolved errors because I don't have cvxpy installed.

huangapple
  • 本文由 发表于 2023年6月8日 11:15:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76428383.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定