使用 Matplotlib 和 Pyinstaller 时遇到问题

时间:2021-01-28 14:54:35

标签: python matplotlib module pyinstaller exe

我写了一个简单的python代码:

UNION

并尝试将其转换为 .exe。 .exe 文件已创建。但是,它不起作用。我收到很多警告:

我有一个 matplotlib 版本 3.2.2。 PyInstaller:4.2。 Python:3.8.5(康达)。我正在使用基础环境。

我收到这些警告(仅使用顶级警告进行编辑):

import matplotlib.pyplot as plt

x=[0,1,2,3,4,9]
plt.figure()

plt.plot(x)

我不明白为什么我安装了很多缺少的模块。全部添加到环境变量“Path”

missing module named multiprocessing.set_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
missing module named multiprocessing.get_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level), PyInstaller.loader.pyimod02_archive (delayed)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
missing module named importlib.lock_held - imported by importlib (optional), ipykernel.iostream (optional)
missing module named multiprocessing.get_context - imported by multiprocessing (top-level), multiprocessing.pool (top-level), multiprocessing.managers (top-level), multiprocessing.sharedctypes (top-level)
missing module named multiprocessing.TimeoutError - imported by multiprocessing (top-level), multiprocessing.pool (top-level)
missing module named fcntl - imported by atomicwrites (optional), psutil._compat (delayed, optional), pty (delayed, optional), tornado.platform.posix (top-level), xmlrpc.server (optional), paramiko.agent (delayed), zmq.eventloop.minitornado.platform.posix (top-level), prompt_toolkit.output.vt100 (delayed), sphinx.util.console (delayed, optional), py._io.terminalwriter (delayed, conditional), gevent.fileobject (optional), gevent.os (optional), gevent.subprocess (conditional)
missing module named termios - imported by tty (top-level), getpass (optional), psutil._compat (delayed, optional), prompt_toolkit.output.vt100 (delayed), prompt_toolkit.input.vt100 (top-level)
missing module named multiprocessing.BufferTooShort - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named multiprocessing.AuthenticationError - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named multiprocessing.cpu_count - imported by multiprocessing (top-level), gevent.testing.testrunner (top-level)
missing module named multiprocessing.Process - imported by multiprocessing (top-level), jupyter_client.ssh.tunnel (top-level), gevent.tests.test__issue600 (top-level)
missing module named System - imported by pyreadline.clipboard.ironpython_clipboard (top-level), pyreadline.keysyms.ironpython_keysyms (top-level), pyreadline.console.ironpython_console (top-level), pyreadline.rlmain (conditional), IPython.utils._process_cli (top-level)
missing module named IronPythonConsole - imported by pyreadline.console.ironpython_console (top-level)
missing module named org - imported by pickle (optional)
missing module named posix - imported by os (conditional, optional), shutil (conditional)
missing module named resource - imported by posix (top-level), test.support (optional), IPython.utils.timing (optional), prometheus_client.process_collector (optional)
missing module named 'win32com.gen_py' - imported by win32com (conditional, optional), C:\Users\al-abiad\Anaconda3\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py (top-level)
missing module named 'six.moves.urllib'.parse - imported by 'six.moves.urllib' (top-level), packaging.requirements (top-level)
runtime module named six.moves - imported by 'six.moves.urllib' (top-level), cryptography.hazmat.backends.openssl.backend (top-level), dateutil.tz.tz (top-level), dateutil.tz._factories (top-level), dateutil.tz.win (top-level), dateutil.rrule (top-level), cycler (top-level)
missing module named six.moves.zip - imported by six.moves (top-level), cycler (top-level)
missing module named six.moves.range - imported by six.moves (top-level), cryptography.hazmat.backends.openssl.backend (top-level), dateutil.rrule (top-level)
missing module named 'six.moves.urllib' - imported by 'six.moves.urllib' (top-level)
missing module named 'pkg_resources.extern.pyparsing' - imported by pkg_resources._vendor.packaging.requirements (top-level), pkg_resources._vendor.packaging.markers (top-level)
missing module named 'com.sun' - imported by pkg_resources._vendor.appdirs (delayed, conditional, optional)
missing module named com - imported by pkg_resources._vendor.appdirs (delayed)
missing module named pkg_resources.extern.packaging - imported by pkg_resources.extern (top-level), pkg_resources (top-level)
missing module named pkg_resources.extern.appdirs - imported by pkg_resources.extern (top-level), pkg_resources (top-level)
missing module named numpy.linalg.inv - imported by numpy.linalg (top-level), numpy.lib.polynomial (top-level), matplotlib.transforms (top-level)
missing module named numpy.testing.knownfailureif - imported by numpy.testing (optional), IPython.external.decorators (optional)
missing module named numpy.testing.KnownFailure - imported by numpy.testing (optional), IPython.external.decorators (optional)
missing module named new - imported by nose.pyversion (optional), nose.ext.dtcompat (delayed)
missing module named compiler - imported by nose.pyversion (conditional, optional), py._code._assertionold (top-level)
missing module named IronPython - imported by nose.suite (conditional)
missing module named unittest2 - imported by nose.plugins.skip (optional)
missing module named uarray - imported by scipy._lib.uarray (conditional, optional)
missing module named psutil._psutil_aix - imported by psutil (top-level), psutil._psaix (top-level)
missing module named psutil._psutil_sunos - imported by psutil (top-level), psutil._pssunos (top-level)
missing module named psutil._psutil_bsd - imported by psutil (top-level), psutil._psbsd (top-level)
missing module named psutil._psutil_osx - imported by psutil (top-level), psutil._psosx (top-level)
missing module named _psutil_linux - imported by psutil (conditional)
missing module named psutil._psutil_posix - imported by psutil (top-level), psutil._pslinux (top-level), psutil._psosx (top-level), psutil._psbsd (top-level), psutil._pssunos (top-level), psutil._psaix (top-level)
missing module named _dummy_threading - imported by dummy_threading (optional)
missing module named _curses - imported by curses (top-level), curses.has_key (top-level)
missing module named twisted - imported by _pytest.unittest (delayed)
missing module named py.process - imported by py (top-level), py._path.svnurl (top-level)
missing module named py.path - imported by py (top-level), py._path.svnurl (top-level), _pytest.doctest (top-level)
missing module named apipkg - imported by py (optional)
missing module named UserDict - imported by attr._compat (conditional), pytz.lazy (optional), jinja2.sandbox (optional), dill._dill (delayed, conditional)
missing module named pep517 - imported by importlib_metadata (delayed)
missing module named 'ptyprocess.ptyprocess' - imported by pexpect.pty_spawn (top-level)
missing module named ptyprocess - imported by pexpect.pty_spawn (top-level)
missing module named scandir - imported by pathlib2 (optional)
missing module named '_pytest.code' - imported by _pytest.hookspec (conditional)
missing module named 'py.path' - imported by _pytest.hookspec (top-level)
missing module named pygments.lexers.RstLexer - imported by pygments.lexers (top-level), sphinx.highlighting (top-level)
missing module named pygments.lexers.TextLexer - imported by pygments.lexers (top-level), sphinx.highlighting (top-level)
missing module named pygments.lexers.CLexer - imported by pygments.lexers (top-level), sphinx.highlighting (top-level)
missing module named pygments.lexers.PythonConsoleLexer - imported by pygments.lexers (top-level), sphinx.highlighting (top-level), sphinx.transforms.post_transforms.code (top-level)
missing module named pygments.lexers.TexLexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level)
missing module named pygments.lexers.Python3Lexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level), sphinx.highlighting (top-level)
missing module named pygments.lexers.PythonLexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level), sphinx.highlighting (top-level), IPython.core.oinspect (top-level)
missing module named pygments.lexers.PerlLexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level)
missing module named pygments.lexers.RubyLexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level)
missing module named pygments.lexers.JavascriptLexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level)
missing module named pygments.lexers.HtmlLexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level)
missing module named pygments.lexers.BashLexer - imported by pygments.lexers (top-level), IPython.lib.lexers (top-level)
missing module named pygments.formatters.LatexFormatter - imported by pygments.formatters (delayed), IPython.lib.display (delayed), nbconvert.filters.highlight (delayed), nbconvert.preprocessors.latex (delayed), sphinx.highlighting (top-level)
missing module named pygments.formatters.HtmlFormatter - imported by pygments.formatters (delayed), IPython.lib.display (delayed), nbconvert.filters.highlight (delayed), nbconvert.filters.markdown_mistune (top-level), nbconvert.preprocessors.csshtmlheader (delayed), sphinx.highlighting (top-level), IPython.core.oinspect (top-level)
missing module named 'setuptools.extern.pyparsing' - imported by setuptools._vendor.packaging.markers (top-level), setuptools._vendor.packaging.requirements (top-level)
missing module named 'setuptools.extern.packaging.version' - imported by setuptools.config (top-level), setuptools.msvc (top-level)
missing module named 'setuptools.extern.packaging.utils' - imported by setuptools.wheel (top-level)
missing module named 'setuptools.extern.packaging.tags' - imported by setuptools.wheel (top-level)
missing module named 'setuptools.extern.packaging.specifiers' - imported by setuptools.config (top-level)
missing module named setuptools.extern.ordered_set - imported by setuptools.extern (top-level), setuptools.dist (top-level), setuptools.command.sdist (top-level)
missing module named setuptools.extern.packaging - imported by setuptools.extern (top-level), setuptools.dist (top-level), setuptools.command.egg_info (top-level)
missing module named 'backports.ssl_match_hostname' - imported by setuptools.ssl_support (optional), urllib3.packages.ssl_match_hostname (optional)
missing module named cStringIO - imported by cPickle (top-level), cffi.ffiplatform (optional), jinja2._compat (conditional), paramiko.py3compat (conditional), babel._compat (conditional), dill._dill (optional), dill._objects (optional), gevent.tests.test__pywsgi (optional)
missing module named copy_reg - imported by cPickle (top-level), cStringIO (top-level), ipykernel.codeutil (optional), gevent._tblib (delayed, optional)
missing module named 'py.builtin' - imported by py._io.terminalwriter (top-level)
missing module named numpy.core.integer - imported by numpy.core (top-level), numpy.fft.helper (top-level)
missing module named numpy.core.conjugate - imported by numpy.core (top-level), numpy.fft._pocketfft (top-level)
missing module named numpy.core.sign - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.isnan - imported by numpy.core (top-level), numpy.linalg.linalg (top-level), numpy.testing._private.utils (delayed)
missing module named numpy.core.divide - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.object_ - imported by numpy.core (top-level), numpy.linalg.linalg (top-level), numpy.testing._private.utils (delayed)
missing module named numpy.core.geterrobj - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.sqrt - imported by numpy.core (top-level), numpy.linalg.linalg (top-level), numpy.fft._pocketfft (top-level)
missing module named numpy.core.add - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.complexfloating - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.inexact - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.cdouble - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.csingle - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.double - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.single - imported by numpy.core (top-level), numpy.linalg.linalg (top-level)
missing module named numpy.core.float32 - imported by numpy.core (top-level), numpy.testing._private.utils (top-level)
missing module named numpy.core.intp - imported by numpy.core (top-level), numpy.testing._private.utils (top-level), numpy.linalg.linalg (top-level)
missing module named pickle5 - imported by numpy.compat.py3k (optional), cloudpickle.compat (conditional, optional)
missing module named numpy.array - imported by numpy (top-level), numpy.ma.core (top-level), numpy.ma.extras (top-level), numpy.ma.mrecords (top-level), numpy.ctypeslib (top-level), dill._objects (optional)
missing module named numpy.recarray - imported by numpy (top-level), numpy.ma.mrecords (top-level)
missing module named numpy.ndarray - imported by numpy (top-level), numpy.ma.core (top-level), numpy.ma.extras (top-level), numpy.ma.mrecords (top-level), numpy.ctypeslib (top-level), IPython.core.magics.namespace (delayed, conditional, optional), dill._dill (delayed)
missing module named numpy.dtype - imported by numpy (top-level), numpy.ma.mrecords (top-level), numpy.ctypeslib (top-level)
missing module named numpy.bool_ - imported by numpy (top-level), numpy.ma.core (top-level), numpy.ma.mrecords (top-level)
missing module named numpy.expand_dims - imported by numpy (top-level), numpy.ma.core (top-level)
missing module named numpy.iscomplexobj - imported by numpy (top-level), numpy.ma.core (top-level)
missing module named numpy.amin - imported by numpy (top-level), numpy.ma.core (top-level)
missing module named numpy.amax - imported by numpy (top-level), numpy.ma.core (top-level)
missing module named numpy.histogramdd - imported by numpy (delayed), numpy.lib.twodim_base (delayed)
missing module named numpy.lib.i0 - imported by numpy.lib (top-level), numpy.dual (top-level)
missing module named numpy.eye - imported by numpy (delayed), numpy.core.numeric (delayed)
missing module named numpy.random.randn - imported by numpy.random (top-level), scipy (top-level)
missing module named numpy.random.rand - imported by numpy.random (top-level), scipy (top-level)
missing module named numpy.linalg.lstsq - imported by numpy.linalg (top-level), numpy.lib.polynomial (top-level)
missing module named numpy.linalg.eigvals - imported by numpy.linalg (top-level), numpy.lib.polynomial (top-level)
missing module named numpy.linalg.matrix_power - imported by numpy.linalg (top-level), numpy.matrixlib.defmatrix (top-level)
missing module named Queue - imported by urllib3.util.queue (conditional), zmq.eventloop.zmqstream (optional), jedi._compatibility (conditional), jedi.inference.compiled.subprocess (optional), dill._objects (conditional), ipykernel.inprocess.socket (optional), ipykernel.inprocess.blocking (optional), gevent.queue (conditional)
missing module named 'gi.repository' - imported by ipykernel.gui.gtk3embed (top-level)
missing module named gi - imported by ipykernel.gui.gtk3embed (top-level)
missing module named gtk - imported by ipykernel.gui.gtkembed (top-level)
missing module named gobject - imported by ipykernel.gui.gtkembed (top-level)
missing module named traitlets.config.Application - imported by traitlets.config (delayed, conditional), traitlets.log (delayed, conditional), ipykernel.kernelspec (top-level), notebook.base.handlers (top-level)
missing module named zmq.ZMQError - imported by zmq (delayed, optional), zmq.sugar.attrsettr (delayed, optional), zmq.eventloop._deprecated (top-level), jupyter_client.channels (top-level)
missing module named zmq.ETERM - imported by zmq (delayed), zmq.error (delayed, conditional), zmq.eventloop._deprecated (top-level)
missing module named zmq.EVENTS - imported by zmq (top-level), zmq._future (top-level)
missing module named "'urllib3.packages.six.moves.urllib'.parse" - imported by urllib3.request (top-level), urllib3.poolmanager (top-level)
runtime module named urllib3.packages.six.moves - imported by http.client (top-level), urllib3.connectionpool (top-level), urllib3.util.response (top-level), 'urllib3.packages.six.moves.urllib' (top-level), urllib3.response (top-level), urllib3.util.queue (top-level)
missing module named gevent.libev._corecffi - imported by gevent.libev (top-level), gevent.libev.watcher (top-level), gevent.libev.corecffi (top-level)
missing module named selectors2 - imported by gevent.selectors (optional), gevent.tests.test__monkey_selectors (optional)
missing module named cares - imported by gevent.resolver.ares (top-level)
missing module named 'gevent.resolver.cares' - imported by gevent.ares (top-level), gevent.tests.test__ares_host_result (optional)
missing module named zmq.backend.zmq_version_info - imported by zmq.backend (top-level), zmq.sugar.version (top-level)
missing module named zmq.backend.Frame - imported by zmq.backend (top-level), zmq.sugar.frame (top-level), zmq.sugar.tracker (top-level)
missing module named zmq.backend.Socket - imported by zmq.backend (top-level), zmq.sugar.socket (top-level)
missing module named zmq.backend.zmq_poll - imported by zmq.backend (top-level), zmq.sugar.poll (top-level)
missing module named pyczmq - imported by zmq.sugar.context (delayed)
missing module named zmq.backend.Context - imported by zmq.backend (top-level), zmq.sugar.context (top-level)
missing module named zmq.backend.has - imported by zmq.backend (top-level), zmq.sugar.constants (top-level)
missing module named zmq.backend.constants - imported by zmq.backend (top-level), zmq.sugar.constants (top-level)
missing module named prompt_toolkit.filters.is_searching - imported by prompt_toolkit.filters (top-level), prompt_toolkit.search (top-level), prompt_toolkit.key_binding.bindings.search (top-level), prompt_toolkit.key_binding.bindings.vi (top-level)
missing module named prompt_toolkit.filters.vi_mode - imported by prompt_toolkit.filters (top-level), prompt_toolkit.document (top-level), prompt_toolkit.key_binding.bindings.page_navigation (top-level), prompt_toolkit.widgets.toolbars (top-level), IPython.terminal.shortcuts (top-level)
missing module named prompt_toolkit.filters.is_done - imported by prompt_toolkit.filters (top-level), prompt_toolkit.layout.menus (top-level), prompt_toolkit.widgets.base (top-level), prompt_toolkit.shortcuts.progress_bar.base (top-level), prompt_toolkit.shortcuts.prompt (top-level)
missing module named prompt_toolkit.filters.has_completions - imported by prompt_toolkit.filters (top-level), prompt_toolkit.layout.menus (top-level), prompt_toolkit.widgets.toolbars (top-level), prompt_toolkit.widgets.dialogs (top-level), IPython.terminal.shortcuts (top-level)
missing module named prompt_toolkit.filters.vi_insert_mode - imported by prompt_toolkit.filters (top-level), prompt_toolkit.layout.containers (top-level), prompt_toolkit.key_binding.bindings.basic (top-level), IPython.terminal.shortcuts (top-level), IPython.terminal.debugger (top-level)
missing module named prompt_toolkit.filters.emacs_insert_mode - imported by prompt_toolkit.filters (top-level), prompt_toolkit.layout.containers (top-level), prompt_toolkit.key_binding.bindings.basic (top-level), prompt_toolkit.key_binding.bindings.emacs (top-level), IPython.terminal.shortcuts (top-level), IPython.terminal.debugger (top-level)
missing module named pydoc_topics - imported by jedi.api.keywords (optional)
missing module named repr - imported by IPython.core.debugger (delayed, optional)
missing module named prompt_toolkit.filters.vi_insert_multiple_mode - imported by prompt_toolkit.filters (top-level), prompt_toolkit.layout.processors (top-level)
missing module named appnope - imported by ipykernel.ipkernel (delayed, conditional)
missing module named trio - imported by ipykernel.trio_runner (top-level), IPython.core.async_helpers (delayed)
missing module named dateutil.tz.tzfile - imported by dateutil.tz (top-level), dateutil.zoneinfo (top-level)
missing module named number - imported by dill._objects (optional)
missing module named _dbm - imported by dbm.ndbm (top-level)
missing module named _gdbm - imported by dbm.gnu (top-level)
missing module named mutex - imported by dill._objects (conditional)
missing module named anydbm - imported by dill._objects (conditional)
missing module named whichdb - imported by anydbm (top-level)
missing module named dumbdbm - imported by anydbm (top-level)
missing module named gdbm - imported by anydbm (top-level)
missing module named dbhash - imported by anydbm (top-level)
missing module named ipykernel.connect_qtconsole - imported by ipykernel (top-level), ipykernel.zmqshell (top-level)
missing module named ipykernel.get_connection_info - imported by ipykernel (top-level), ipykernel.zmqshell (top-level)
missing module named ipykernel.get_connection_file - imported by ipykernel (top-level), ipykernel.zmqshell (top-level)
missing module named 'IPython.kernel.zmq' - imported by IPython (delayed)
missing module named matplotlib.tri.Triangulation - imported by matplotlib.tri (top-level), matplotlib.tri.trifinder (top-level), matplotlib.tri.tritools (top-level), matplotlib.tri.triinterpolate (top-level)
missing module named matplotlib.axes.Axes - imported by matplotlib.axes (delayed), matplotlib.legend (delayed), matplotlib.projections.geo (top-level), matplotlib.projections.polar (top-level), mpl_toolkits.mplot3d.axes3d (top-level), matplotlib.figure (top-level), matplotlib.pyplot (top-level)'

我尝试将 matplotlib.pyplot 添加到隐藏导入中,但这不起作用。

当我尝试打开 .exe 时出现“无法执行脚本 pyi.rth.certifi”

有谁知道这个问题的解决方法或者遇到过这样的问题吗?

0 个答案:

没有答案
相关问题