ModuleNotFoundError:在heroku中没有名为'bs4'的模块

问题描述 投票:-1回答:1

我正在尝试使用beautifulsoup制作一个行机器人,并将代码推送到Heroku。

我的代码可以在本地运行,但是在推送到Heroku后出现以下错误:

2019-11-30T13:31:11.000000+00:00 app[api]: Build started by user [email protected]
2019-11-30T13:31:39.747108+00:00 heroku[web.1]: State changed from crashed to starting
2019-11-30T13:31:39.433541+00:00 app[api]: Deploy b5926928 by user [email protected]
2019-11-30T13:31:39.433541+00:00 app[api]: Release v70 created by user [email protected]
2019-11-30T13:31:45.640906+00:00 heroku[web.1]: Starting process with command `python app.py`
2019-11-30T13:31:48.788434+00:00 heroku[web.1]: State changed from starting to crashed
2019-11-30T13:31:48.693417+00:00 app[web.1]: Traceback (most recent call last):
2019-11-30T13:31:48.693438+00:00 app[web.1]:   File "app.py", line 11, in <module>
2019-11-30T13:31:48.693606+00:00 app[web.1]:     from fsm import TocMachine
2019-11-30T13:31:48.693609+00:00 app[web.1]:   File "/app/fsm.py", line 4, in <module>
2019-11-30T13:31:48.693743+00:00 app[web.1]:     from ptt import ptt
2019-11-30T13:31:48.693746+00:00 app[web.1]:   File "/app/ptt.py", line 2, in <module>
2019-11-30T13:31:48.693878+00:00 app[web.1]:     from bs4 import BeautifulSoup
2019-11-30T13:31:48.693884+00:00 app[web.1]: ModuleNotFoundError: No module named 'bs4'
2019-11-30T13:31:48.774322+00:00 heroku[web.1]: Process exited with status 1
2019-11-30T13:31:51.000000+00:00 app[api]: Build succeeded

requirements.txt中,我包含了bs4==0.0.1beautifulsoup4==4.7.1,但Heroku中的日志仍然存在此错误

以下为requirements.txt代码

-i https://pypi.org/simple
certifi==2019.9.11
chardet==3.0.4
click==7.0
flask==1.0.2
future==0.18.1
idna==2.8
itsdangerous==1.1.0
jinja2==2.10.3
line-bot-sdk==1.14.0
markupsafe==1.1.1
pygraphviz==1.5
python-dotenv==0.10.3
requests==2.22.0
six==1.12.0
transitions==0.6.9
urllib3==1.25.6
werkzeug==0.16.0
bs4==0.0.1
beautifulsoup4==4.7.1

以下从git push输出

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 275 bytes | 275.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Apt app detected
remote: -----> Reusing cache
remote: -----> Updating apt caches
remote:        Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
remote:        Hit:2 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
remote:        Get:3 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
remote:        Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
remote:        Fetched 88.7 kB in 1s (133 kB/s)
remote:        Reading package lists...
remote: -----> Fetching .debs for graphviz
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following additional packages will be installed:
remote:          fonts-liberation libann0 libcdt5 libcgraph6 libgts-0.7-5 libgts-bin libgvc6
remote:          libgvpr2 liblab-gamut1 libpathplan4 libxaw7 libxmu6
remote:        Suggested packages:
remote:          graphviz-doc
remote:        The following NEW packages will be installed:
remote:          fonts-liberation graphviz libann0 libcdt5 libcgraph6 libgts-0.7-5 libgts-bin
remote:          libgvc6 libgvpr2 liblab-gamut1 libpathplan4 libxaw7 libxmu6
remote:        0 upgraded, 13 newly installed, 0 to remove and 57 not upgraded.
remote:        Need to get 0 B/2,889 kB of archives.
remote:        After this operation, 11.6 MB of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Fetching .debs for libgraphviz-dev
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following additional packages will be installed:
remote:          adwaita-icon-theme gtk-update-icon-cache humanity-icon-theme libatk1.0-0
remote:          libatk1.0-data libcdt5 libcgraph6 libgail-common libgail18 libgtk2.0-0
remote:          libgtk2.0-bin libgtk2.0-common libgts-0.7-5 libgts-bin libgvc6
remote:          libgvc6-plugins-gtk libgvpr2 liblab-gamut1 libpathplan4 libxcomposite1
remote:          libxcursor1 libxdamage1 libxdot4 libxfixes3 libxi6 libxinerama1 libxrandr2
remote:          ubuntu-mono
remote:        Suggested packages:
remote:          gvfs
remote:        The following NEW packages will be installed:
remote:          adwaita-icon-theme gtk-update-icon-cache humanity-icon-theme libatk1.0-0
remote:          libatk1.0-data libcdt5 libcgraph6 libgail-common libgail18 libgraphviz-dev
remote:          libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgts-0.7-5 libgts-bin libgvc6
remote:          libgvc6-plugins-gtk libgvpr2 liblab-gamut1 libpathplan4 libxcomposite1
remote:          libxcursor1 libxdamage1 libxdot4 libxfixes3 libxi6 libxinerama1 libxrandr2
remote:          ubuntu-mono
remote:        0 upgraded, 29 newly installed, 0 to remove and 57 not upgraded.
remote:        Need to get 0 B/8,221 kB of archives.
remote:        After this operation, 46.2 MB of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Fetching .debs for pkg-config
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 57 not upgraded.
remote:        Need to get 0 B/45.0 kB of archives.
remote:        After this operation, 0 B of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Installing adwaita-icon-theme_3.28.0-1ubuntu1_all.deb
remote: -----> Installing fonts-liberation_1%3a1.07.4-7~18.04.1_all.deb
remote: -----> Installing graphviz_2.40.1-2_amd64.deb
remote: -----> Installing gtk-update-icon-cache_3.22.30-1ubuntu4_amd64.deb
remote: -----> Installing humanity-icon-theme_0.6.15_all.deb
remote: -----> Installing libann0_1.1.2+doc-6_amd64.deb
remote: -----> Installing libatk1.0-0_2.28.1-1_amd64.deb
remote: -----> Installing libatk1.0-data_2.28.1-1_all.deb
remote: -----> Installing libcdt5_2.40.1-2_amd64.deb
remote: -----> Installing libcgraph6_2.40.1-2_amd64.deb
remote: -----> Installing libgail18_2.24.32-1ubuntu1_amd64.deb
remote: -----> Installing libgail-common_2.24.32-1ubuntu1_amd64.deb
remote: -----> Installing libgraphviz-dev_2.40.1-2_amd64.deb
remote: -----> Installing libgtk2.0-0_2.24.32-1ubuntu1_amd64.deb
remote: -----> Installing libgtk2.0-bin_2.24.32-1ubuntu1_amd64.deb
remote: -----> Installing libgtk2.0-common_2.24.32-1ubuntu1_all.deb
remote: -----> Installing libgts-0.7-5_0.7.6+darcs121130-4_amd64.deb
remote: -----> Installing libgts-bin_0.7.6+darcs121130-4_amd64.deb
remote: -----> Installing libgvc6_2.40.1-2_amd64.deb
remote: -----> Installing libgvc6-plugins-gtk_2.40.1-2_amd64.deb
remote: -----> Installing libgvpr2_2.40.1-2_amd64.deb
remote: -----> Installing liblab-gamut1_2.40.1-2_amd64.deb
remote: -----> Installing libpathplan4_2.40.1-2_amd64.deb
remote: -----> Installing libxaw7_2%3a1.0.13-1_amd64.deb
remote: -----> Installing libxcomposite1_1%3a0.4.4-2_amd64.deb
remote: -----> Installing libxcursor1_1%3a1.1.15-1_amd64.deb
remote: -----> Installing libxdamage1_1%3a1.1.4-3_amd64.deb
remote: -----> Installing libxdot4_2.40.1-2_amd64.deb
remote: -----> Installing libxfixes3_1%3a5.0.3-1_amd64.deb
remote: -----> Installing libxi6_2%3a1.7.9-1_amd64.deb
remote: -----> Installing libxinerama1_2%3a1.1.3-1_amd64.deb
remote: -----> Installing libxmu6_2%3a1.1.2-2_amd64.deb
remote: -----> Installing libxrandr2_2%3a1.5.1-1_amd64.deb
remote: -----> Installing pkg-config_0.29.1-0ubuntu2_amd64.deb
remote: -----> Installing ubuntu-mono_16.10+18.04.20181005-0ubuntu1_all.deb
remote: -----> Writing profile script
remote: -----> Rewrite package-config files
remote: -----> Python app detected
remote:        Skipping installation, as Pipfile.lock hasn't changed since last deploy.
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 74.2M
remote: -----> Launching...
remote:        Released v73
remote:        https://computertheory-project.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.

我该如何解决这个问题?

python heroku beautifulsoup
1个回答
0
投票

您的构建输出中说

© www.soinside.com 2019 - 2024. All rights reserved.