title: How to import the modules you need when converting Python code to exe
body: <p>When converting Python code to exe using pyinstaller, it does not find some modules that I have installed, therefore, the program does not run on other PCs.</p>
  <p>All plugins are shown below:</p>
  <pre><code>import getpass
  import os.path
  import random
  import smtplib
  import ssl
  import time
  import keyboard
  import psutil
  from email import encoders
  from email.mime.base import MIMEBase
  from email.mime.multipart import MIMEMultipart
  from email.mime.text import MIMEText
  </code></pre>
  <p>I go to cmd, cd to a directory in a file, and then write:</p>
  <pre><code>pyinstaller &quot;directory with .py file&quot; -d -x &quot;save directory&quot;
  </code></pre>
  <p>The build and dist folders are created in the directory. I rummaged in them, I still did not find where to throw the missing modules. Found a txt-file that says that he could not capture.</p>
  <p>here is a snippet from a txt file:</p>
  <pre><code>missing module named _posixshmem - imported by multiprocessing.resource_tracker (conditional), multiprocessing.shared_memory (conditional)
  missing module named 'org.python' - imported by copy (optional), setuptools.sandbox (conditional), xml.sax (delayed, conditional)
  missing module named _scproxy - imported by urllib.request (conditional)
  missing module named pwd - imported by posixpath (delayed, conditional), shutil (optional), tarfile (optional), pathlib (delayed, conditional, optional), subprocess (optional), http.server (delayed, optional), webbrowser (delayed ), netrc (delayed, conditional), getpass (delayed), distutils.util (delayed, conditional, optional), psutil (optional), distutils.archive_util (optional)
  missing module named urllib.pathname2url - imported by urllib (conditional), PyInstaller.lib.modulegraph._compat (conditional)
  missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
  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 _posixsubprocess - imported by subprocess (optional), multiprocessing.util (delayed)
  missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (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 pep517 - imported by importlib.metadata (delayed)
  missing module named posix - imported by os (conditional, optional), shutil (conditional)
  missing module named resource - imported by posix (top-level), test.support (delayed, conditional, optional), psutil._pslinux (optional)
  missing module named grp - imported by shutil (optional), tarfile (optional), pathlib (delayed, optional), subprocess (optional), distutils.archive_util (optional)
  missing module named asyncio.DefaultEventLoopPolicy - imported by asyncio (delayed, conditional), asyncio.events (delayed, conditional)
  missing module named termios - imported by tty (top-level), getpass (optional), psutil._compat (delayed, optional)
  missing module named vms_lib - imported by platform (delayed, optional)
  missing module named java - imported by platform (delayed)
  missing module named _winreg - imported by platform (delayed, optional), pkg_resources._vendor.appdirs (delayed, conditional)
  missing module named readline - imported by cmd (delayed, conditional, optional), code (delayed, conditional, optional), pdb (delayed, optional)
  missing module named org - imported by pickle (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 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)
  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._psutil_linux - imported by psutil (top-level), psutil._pslinux (top-level)
  missing module named fcntl - imported by keyboard._nixcommon (delayed), psutil._compat (delayed, optional)
  missing module named dummy_threading - imported by psutil._compat (optional), numpy.distutils.misc_util (optional), numpy.distutils.ccompiler (optional)
  missing module named _curses - imported by curses (top-level), curses.has_key (top-level)
  missing module named AppKit - imported by keyboard._darwinkeyboard (top-level)
  missing module named Quartz - imported by keyboard._darwinkeyboard (top-level)
  missing module named Queue - imported by keyboard (optional), keyboard._nixcommon (optional), keyboard._generic (optional)
  </code></pre>
  <p>Tell me where to put the missing modules?</p>
  <p>I know that this is a perversion, but it should be so.</p>