简体   繁体   English

VSC 说模块已安装但不会在代码中导入

[英]VSC says module is installed but won't import it in code

终端说安装时 Python 街机模块“要求已经满足”,但不会导入代码。

Check whether the pip you are using was paired to the python interpreter you are using.检查您使用的 pip 是否与您使用的 python 解释器配对。

在此处输入图片说明

If not, you can switch the python interpreter you are using to the one which has installed the packages you want to import.如果没有,您可以将正在使用的 python 解释器切换到安装了要导入的包的解释器。

在此处输入图片说明

Or you can install the package with the proper pip which can install the package to the python interpreter you are using for now.或者您可以使用适当的 pip 安装包,该 pip 可以将包安装到您现在使用的 python 解释器。

You can create a new terminal with the shortcut of Ctrl+Shift+`.您可以使用快捷键 Ctrl+Shift+` 创建一个新终端。 The python extension will activate the python interpreter you have selected when the terminal is created. python 扩展将激活您在创建终端时选择的 python 解释器。

在此处输入图片说明

If you still can not get the proper pip, this means you have not installed the pip in this python interpreter environment.如果还是无法获取到正确的pip,说明你还没有在这个python解释器环境中安装pip。 You can install it with this command python -m ensurepip .您可以使用此命令python -m ensurepip安装它。

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

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