通过 Pip 安装的包不会导入 Python VSCode [Windows 10]
尝试在 Windows 上通过 pip 安装新包,但安装后 - Python 无法解析导入。例如,我刚刚安装了 Python 包 similaritymeasures
并且 pip 正确安装了它,但是当我将其导入到我的 Python 程序中时,它找不到导入。有谁知道解决这个问题的方法吗?
Trying to install new packages via pip on Windows, but after it installs - Python cannot resolve the import. For Example, I have just installed the Python package similaritymeasures
and pip correctly installed it, but when I import it into my Python program, it cannot find the import. Has anyone know a way around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保下载包后重新启动 VSCode。有时,当您在 VSCode 仍在运行时下载包时,使用
导入相似度测量
时它无法识别该包。如果这不起作用,请确保 VSCode 使用您首选的 python 版本。您可能有多个 python 版本,并且它使用不兼容的版本来运行您的代码。这可以通过单击窗口右下角的框来完成:(例如)3.9.5 64 位。然后从弹出窗口中选择不同的(最好是旧的)版本。
这些是我想到的解决方案,希望对您有所帮助。
Make sure that you restart VSCode after downloading your package. Sometimes, when you download a package while VSCode is still running, it doesn't recognize the package when using
import similaritymeasures
.If that didn't work, then make sure that VSCode is using your preferred version of python. It is possible that you have more than one python version and it's using a non-compatible one to run your code. This can be done at the bottom right corner of the window by clicking the box that says: (for example) 3.9.5 64-bit. Then select a different (preferably older) version from the pop up widnow.
These are the solutions that came to my mind, I hope this helped.