英文:
"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环境)。
右下角显示当前工作区使用的Python版本,您也可以单击它进行切换
> "cvxpy" is not accessed Pylance
这个警告意味着您还没有使用 cvxpy
,这不是错误。如果您在随后的代码中使用了 cvxpy
,这个警告会消失。
您可以看到它的阴影发生了变化。还有 Import "cvxpy" 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).
The lower right corner displays the python version being used in the current workspace, and you can also click it to switch
> "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.
You can see it's shades change. There is also Import "cvxpy" could not be resolved
errors because I don't have cvxpy
installed.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论