python项目中未见带有PIP的软件包(无法导入)

发布于 2025-02-03 04:35:20 字数 190 浏览 3 评论 0 原文

在Windows 10上运行,我安装了Python 3.10.4。

我正在Virtualenv上运行Python应用程序,每当我使用PIP安装软件包时,它不会反映在代码中的导入语句中,但是“ PIP列表”命令显示。

另外,每当我使用Pycharm的Python解释器安装软件包时,它会反映在代码中。任何人都可以在这件事上提供帮助,我被困。

Running on Windows 10, I have python 3.10.4 installed.

I am running my python app on virtualenv and whenever I am installing the package with pip it is not reflected in the import statement in the code however, it is shown by "pip list" command.

Also, Whenever I am using pycharm's python interpreter for installing the package it is reflected in the code. Can anyone help in this matter, I am stuck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笨死的猪 2025-02-10 04:35:20

似乎您正在使用系统Python环境安装软件包,或者您没有配置IDE。

尝试此尝试转到项目文件夹打开Windows终端

  • 激活您的evarioment 。\ your-env-name \ scripts \ activate \ activate
  • 使用 where.exe pip 在场<存在<如果存在< code> pip.exe 'env-name'evarioment中的路径
  • 如果在场,则在终端中安装pip安装并在终端执行Python代码时,
  • 如果您希望IDE识别您的IDE在您需要配置它的活力环境,

我指出了两种配置指南,其中一种带有pycharm,一个带有vscode

https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html#existing-environment

https://code.visualstudio.com/docs/python/environments

It seems like that you are installing the package with the system python environment or that you didn't configure the ide.

Try this go to your project folder open the Windows terminal

  • activate your evarioment .\your-env-name\Scripts\activate
  • check with where.exe pip if is present the pip.exe path in your 'env-name' evarioment
  • if is present you should have no problem installing with pip install in the terminal and executing python code from the terminal
  • if you want your ide to recognise your imports in the vitual envirioment you need to configure it

I point to two configuration guides one with pycharm and one with vscode

https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html#existing-environment

https://code.visualstudio.com/docs/python/environments

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文