简体   繁体   English

Vscode:如何为其他 python 解释器添加模块?

[英]Vscode : How I can add module for other python interpreter?

在此处输入图像描述

Hi!你好! I tried to use python 3.8 in vscode.我尝试在 vscode 中使用 python 3.8。 But when I changed the version of interpreter, my modules made error.但是当我更改解释器的版本时,我的模块出错了。 So after changed the interpreter from 3.10.5 to 3.8.9,I input pip3 install 000. But, That is not working.因此,将解释器从 3.10.5 更改为 3.8.9 后,我输入 pip3 install 000。但是,这不起作用。

How I can handle this?我该如何处理?

  1. How I can change the main version of python in VScode如何在 VScode 中更改 python 的主要版本
  2. How I can add library for my sub python interpreter?如何为我的子 python 解释器添加库?

Thank you!谢谢!

For the first question, you can use "ctrl+shift+P" to choose your python interpreter.对于第一个问题,您可以使用“ctrl+shift+P”来选择您的 Python 解释器。 And for jupyter file, you can change the kernel by clicking the button in your picture:对于 jupyter 文件,您可以通过单击图片中的按钮来更改内核:

在此处输入图像描述

For the second question,usually, when you select an interpreter, pip will automatically install the package into the library under the selected interpreter.对于第二个问题,通常当你选择一个解释器时,pip 会自动将包安装到所选解释器下的库中。 You can use the following command:您可以使用以下命令:

pip install packageName --target="sub python path"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM