2015-02-08 53 views
0

我试图使用py2exe将python脚本转换为.exe,但是我得到的错误没有名为'BeautifulSoup'的模块。我安装了BeatifulSoup 3和4。我也试过[BS4.BeautifulSoup]和[BeautifulSoup4]没有名为beautifulsoup的模块

from distutils.core import setup 
import py2exe 

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

它时直接执行它作为工作的Python ? – 2015-02-08 18:45:54

+0

从bs4导入Beautifulsoup在Python命令行中工作。 – TotalNewb 2015-02-08 18:48:52

+0

您正在从repl的'bs4'导入,因此在您的配置中使用'bs4'。 – KevinOrr 2015-02-08 19:01:59

回答

1

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

Py2exe doesn't find bs4

显然,py2exe不支持压缩的鸡蛋,所以关键是要卸载BeautifulSoup与--always-解压选项重新安装: