ModuleNotFoundError:没有名为“win10toast”的模块;bs4.FeatureNotFound:找不到具有您请求的功能的树生成器:lxm

2024-03-29 14:36:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经用pip命令安装了这两个命令,它显示它已经安装,但是没有工作。我也更新了pip的版本,它仍然显示了更新pip的命令。在

    C:\Users\DELL>pip install win10toast
    Requirement already satisfied: win10toast in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (0.9)
    Requirement already satisfied: setuptools in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from win10toast) (40.8.0)
    Requirement already satisfied: pypiwin32 in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from win10toast) (223)
    Requirement already satisfied: pywin32>=223 in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from pypiwin32->win10toast) (225)
    You are using pip version 19.0.3, however version 19.2.3 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.

    C:\Users\DELL>cd C:\Users\DELL\desktop

    C:\Users\DELL\Desktop>python test.py
    Traceback (most recent call last):
      File "test.py", line 3, in <module>
        from win10toast import ToastNotifier
    ModuleNotFoundError: No module named 'win10toast'
^{pr2}$

Tags: pipinliblocalrequirementusersappdatadell
1条回答
网友
1楼 · 发布于 2024-03-29 14:36:15

让我们来分析一下正在发生的事情:

  1. 您的pip install lxml命令导致文件夹"...python\python37\lib\site-packages..."中已满足的错误
  2. pip3 install lxml导致文件夹"...python\python37\lib\site-packages..."中已满足的错误

所以您的pippip3都指向安装在中的python发行版 "...python\python37,但是当您执行脚本时,bs4是从"...Python\Python37-32\lib\site-packages..."导入的(注意Python37-32pip指向的路径不同)。这让我相信您有两个不同的python并排安装,pip和{指向不同的安装,这就造成了混乱。在

在评论中,您说您已经安装了anaconda,这当然是现在的第三个python发行版。为了澄清这一点,我建议

  1. 卸载之前的python安装,然后确保"...Python\Python37-32\lib\site-packages..."和{}都已删除/清空
  2. 确保所有像pythonpip这样的命令现在都指向您的anaconda安装
  3. 为项目创建并激活虚拟环境(如果需要)
  4. 安装bs4conda install -c anaconda beautifulsoup4和{}:pip install win10toast

现在所有进口商品都应该运转良好

相关问题 更多 >