[英]unable to import a library into VS code
I installed pywhatkit , and its stored along with other packages in my python3.8 file.我安装了pywhatkit ,并将其与其他包一起存储在我的 python3.8 文件中。 However, I am not able to import it to VS code or any other IDEs.
但是,我无法将其导入 VS 代码或任何其他 IDE。 I tried installing tkinter.
我尝试安装 tkinter。 But I facing the same issue again.What should i do ?
但是我再次面临同样的问题。我该怎么办?
Sometimes VS Code does this.有时 VS Code 会这样做。 You should install a library , after that just restart VS Code and the problem should be solved .
您应该安装一个库,之后只需重新启动 VS Code 即可解决问题。 However, if the problem still occurs, it will be due to the Python version .
但是,如果问题仍然存在,则是由于Python 版本。
You are using Python 3 , the issue is most likely that when you installed pywhatkit and tkinter you used the pip install
library
command, which will only install them for Python 2 .您正在使用Python 3,这个问题是最有可能的是,当你安装pywhatkit和Tkinter的您使用
pip install
library
命令,该命令将只安装他们的Python 2。 To install the libraries for Python 3 just use the pip3 install
library
command in place of pip .要安装Python 3的库,只需使用
pip3 install
library
命令代替pip 。
Make sure you have selected the right python interpreter.确保您选择了正确的 Python 解释器。 The Status Bar always shows the current interpreter:
状态栏总是显示当前的解释器:
Inspect whether you can find the packages you want to import in this environment.检查是否可以在此环境中找到要导入的包。
Inspect where the packages you have installed through pip: pip show xxx
.通过 pip 检查您安装的软件包的位置:
pip show xxx
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.