如何使用Nuitka编译具有请求模块的.py脚本?

How to compile .py script which has request module by using Nuitka?

使用Python = 3.6.5rc版本。

当我运行这个命令时:

nuitka3 --portable pythonic.py

我得到了这个结果:

Nuitka:WARNING:/home/user/project/emblema:1: Cannot find '_frozen_importlib_external' in package 'emblema' as absolute import (tried _frozen_importlib_external).
Nuitka:WARNING:/usr/local/lib/python3.6/dist-packages/pyperclip/__init__.py:134: Cannot find 'gtk' in package 'pyperclip' as absolute import (tried gtk).
Nuitka:WARNING:/usr/local/lib/python3.6/dist-packages/pyperclip/__init__.py:159: Cannot find 'qtpy.QtWidgets' in package 'pyperclip' as absolute import (tried qtpy.QtWidgets).
Nuitka:WARNING:/usr/local/lib/python3.6/dist-packages/pyperclip/__init__.py:159: Cannot find 'qtpy' in package 'pyperclip' as absolute import (tried qtpy).
Nuitka:WARNING:/usr/local/lib/python3.6/dist-packages/pyperclip/__init__.py:474: Cannot find 'Foundation' in package 'pyperclip' as absolute import (tried Foundation).
Nuitka:WARNING:/usr/local/lib/python3.6/dist-packages/pyperclip/__init__.py:475: Cannot find 'AppKit' in package 'pyperclip' as absolute import (tried AppKit).
Nuitka:WARNING:Use '--plugin-enable=qt-plugins' for: Inclusion of Qt plugins.
Nuitka:WARNING:/home/stack/.local/lib/python3.6/site-packages/bs4/dammit.py:24: Cannot find 'cchardet' in package 'bs4' as absolute import (tried cchardet).
Nuitka:WARNING:/home/stack/.local/lib/python3.6/site-packages/bs4/dammit.py:44: Cannot find 'iconv_codec' in package 'bs4' as absolute import (tried iconv_codec).
Nuitka:WARNING:Use '--plugin-enable=pylint-warnings' for: Understand PyLint/PyDev annotations for warnings.
Nuitka:WARNING:/usr/lib/python3/dist-packages/html5lib/filters/alphabeticalattributes.py:8: Cannot find 'ordereddict' in package 'html5lib.filters' as absolute import (tried ordereddict).
Nuitka:WARNING:/usr/lib/python3/dist-packages/html5lib/treewalkers/etree.py:7: Cannot find 'ordereddict' in package 'html5lib.treewalkers' as absolute import (tried ordereddict).
Nuitka:WARNING:/usr/lib/python3/dist-packages/html5lib/treewalkers/genshi.py:3: Cannot find 'genshi.core' in package 'html5lib.treewalkers' as absolute import (tried genshi.core).
Nuitka:WARNING:/usr/lib/python3/dist-packages/html5lib/treewalkers/genshi.py:3: Cannot find 'genshi' in package 'html5lib.treewalkers' as absolute import (tried genshi).
Nuitka:WARNING:/usr/lib/python3/dist-packages/html5lib/html5parser.py:9: Cannot find 'ordereddict' in package 'html5lib' as absolute import (tried ordereddict).
Nuitka:WARNING:/usr/lib/python3/dist-packages/html5lib/_trie/datrie.py:3: Cannot find 'datrie' in package 'html5lib._trie' as absolute import (tried datrie).
Nuitka:WARNING:/usr/lib/python3/dist-packages/requests/compat.py:41: Cannot find 'urlparse' in package 'requests' as absolute import (tried urlparse).
Nuitka:WARNING:/usr/lib/python3/dist-packages/requests/compat.py:42: Cannot find 'urllib2' in package 'requests' as absolute import (tried urllib2).
Nuitka:WARNING:/usr/lib/python3/dist-packages/requests/compat.py:43: Cannot find 'cookielib' in package 'requests' as absolute import (tried cookielib).
Nuitka:WARNING:/usr/lib/python3/dist-packages/requests/compat.py:44: Cannot find 'Cookie' in package 'requests' as absolute import (tried Cookie).
Nuitka:WARNING:/usr/lib/python3/dist-packages/urllib3/packages/ordered_dict.py:11: Cannot find '_abcoll' in package 'urllib3.packages' as absolute import (tried _abcoll).
Nuitka:WARNING:/usr/lib/python3/dist-packages/urllib3/packages/ssl_match_hostname/__init__.py:13: Cannot find 'backports.ssl_match_hostname' in package 'urllib3.packages.ssl_match_hostname' as absolute import (tried backports.ssl_match_hostname).
Nuitka:WARNING:/usr/lib/python3/dist-packages/urllib3/packages/ssl_match_hostname/__init__.py:13: Cannot find 'backports' in package 'urllib3.packages.ssl_match_hostname' as absolute import (tried backports).
Nuitka:WARNING:/usr/lib/python3/dist-packages/urllib3/contrib/socks.py:27: Cannot find 'socks' in package 'urllib3.contrib' as absolute import (tried socks).
Nuitka:WARNING:/usr/lib/python3/dist-packages/asn1crypto/_iri.py:22: Cannot find 'urlparse' in package 'asn1crypto' as absolute import (tried urlparse).
Nuitka:WARNING:Unresolved '__import__' call at '/usr/lib/python3/dist-packages/requests/packages.py:7' may require use of '--recurse-directory'.

我需要使用哪个命令才能让 Nuitka 看到 requests & bs4 模块?

使用这个命令:

nuitka3 --portable --recurse-directory pythonic.py

如果这不起作用,

nuitka3 --portable --recurse-all pythonic.py

或通过此命令使用 pyinstaller

pip install pyinstaller
pyinstaller --onefile pythonic.py