问题
In my original code, I have the line:
from bs4 import BeautifulSoup
When I use py2exe, it builds fine but further up in the output it says:
The following modules appear to be missing
['_scproxy', 'bs4']
I specifically put bs4 in the py2exe options:
"includes": ["bs4.BeautifulSoup"]
Is that how I should be referencing BeautifulSoup in the includes statement? The fella over here didn't know how to do it either: 3rd Party Libraries and Py2exe
Do I need to use packages instead of includes or something? All regular libraries and some other like mechanize import fine, but I can't get BeautifulSoup to work fine. Any advice is appreciated.
EDIT: I solved part of this by uninstall BeautifulSoup and re-installing with --always-unzip option:
easy_install --always-unzip beautifulsoup4
However, it added 9 new missing modules. One being '_scproxy'.
回答1:
First thing to check is that you have your setup.py in the same directory as your module and your are running it from that directory.
If that doesn't work your should add your module to your path in setup.py:
module_path = r'path\to\your\BeautifulSoup\module'
if module_path not in sys.path:
sys.path.append(modules_path)
来源:https://stackoverflow.com/questions/21167026/py2exe-doesnt-find-bs4