首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Nuitka编译具有请求模块的.py脚本?

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

Stack Overflow用户
提问于 2018-07-09 16:46:46
回答 1查看 1.7K关注 0票数 1

使用Python = 3.6.5rc版本。

当我运行这个命令时:

代码语言:javascript
复制
nuitka3 --portable pythonic.py

我得到了这个结果:

代码语言:javascript
复制
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'.

我需要使用哪个命令来生成能够查看请求和bs4模块的Nuitka?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-07-09 16:50:35

使用以下命令:

代码语言:javascript
复制
nuitka3 --portable --recurse-directory pythonic.py

如果这样不行的话,

代码语言:javascript
复制
nuitka3 --portable --recurse-all pythonic.py

或在此命令中使用pyinstaller

代码语言:javascript
复制
pip install pyinstaller
pyinstaller --onefile pythonic.py
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51250407

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档