Python 没有名为beautifulsoup的模块

Python 没有名为beautifulsoup的模块,python,beautifulsoup,py2exe,Python,Beautifulsoup,Py2exe,我正试图使用py2exe将python脚本转换为.exe,但出现错误:没有名为“BeautifulSoup”的模块。我已安装BeatifulSoup 3和4。我还尝试了[BS4.BeautifulSoup]和[BeautifulSoup4] from distutils.core import setup import py2exe setup( windows=[{'script': 'strange.py'}], options={ 'py2exe':

我正试图使用py2exe将python脚本转换为.exe,但出现错误:没有名为“BeautifulSoup”的模块。我已安装BeatifulSoup 3和4。我还尝试了[BS4.BeautifulSoup]和[BeautifulSoup4]

from distutils.core import setup
import py2exe

setup(
    windows=[{'script': 'strange.py'}],
    options={
        'py2exe': 
        {
            'includes': ['BeautifulSoup'],
        }   
    }
)

下面的线程应该为您的问题提供解决方案

显然,py2exe不支持压缩鸡蛋,因此关键是卸载BeautifulSoup并使用--always unzip选项重新安装:

easy_install --always-unzip beautifulsoup4

当直接以python的形式执行它时,它工作吗?从bs4导入Beautifulsoup在python命令行中工作。您是从repl的
bs4
导入的,所以在配置中使用
bs4
。您的意思是使用“包含”:[“bs4”]?因为这会导致错误“无模块bs4”,所以您是否尝试了
'includes':['beautifulsoup4']