简体   繁体   中英

Can't install Pyinstaller through pip

I am reasonably new to python and want to make a .exe from a .py.

However when i try to install pyinstaller with pip i get the following error: I tried numerous things but cant resolve it.

Collecting pyinstaller
  Using cached pyinstaller-5.2-py3-none-win_amd64.whl (1.2 MB)
Collecting pyinstaller-hooks-contrib>=2021.4
  Using cached pyinstaller_hooks_contrib-2022.8-py2.py3-none-any.whl (239 kB)
Collecting pefile>=2022.5.30
  Using cached pefile-2022.5.30.tar.gz (72 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: setuptools in c:\program files\spyder\pkgs (from pyinstaller) (62.3.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\program files\spyder\pkgs (from pyinstaller) (0.2.0)
Collecting altgraph
  Using cached altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Collecting future
  Using cached future-0.18.2.tar.gz (829 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
  error: subprocess-exited-with-error
  
  python setup.py egg_info did not run successfully.
  exit code: 1
  
  [6 lines of output]
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\Z640179\AppData\Local\Temp\pip-install-klih4e96\future_d33b369ed28249c0b3c49bd67cf826d5\setup.py", line 86, in <module>
      import src.future
  ModuleNotFoundError: No module named 'src'
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for detail

Does anybody know how to resolve this ?

EDIT: i tried installing SRC but got the following problem:

Collecting src
  Using cached src-0.0.7.zip (6.3 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: src
  Building wheel for src (setup.py): started
  Building wheel for src (setup.py): finished with status 'error'
  Running setup.py clean for src
Failed to build src
Installing collected packages: src
  Running setup.py install for src: started
  Running setup.py install for src: finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
  error: subprocess-exited-with-error
  
  python setup.py bdist_wheel did not run successfully.
  exit code: 1
  
  [49 lines of output]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib
  creating build\lib\src
  copying src\__init__.py -> build\lib\src
  running egg_info
  writing src.egg-info\PKG-INFO
  writing dependency_links to src.egg-info\dependency_links.txt
  deleting src.egg-info\entry_points.txt
  writing requirements to src.egg-info\requires.txt
  writing top-level names to src.egg-info\top_level.txt
  reading manifest file 'src.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'LICENSE.rst'
  writing manifest file 'src.egg-info\SOURCES.txt'
  C:\Program Files\Spyder\pkgs\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\Z640179\AppData\Local\Temp\pip-install-knke7ajt\src_eb79a5c109004a059d46335d661a3522\setup.py", line 70, in <module>
      setup(
    File "C:\Program Files\Spyder\pkgs\setuptools\__init__.py", line 87, in setup
      return distutils.core.setup(**attrs)
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\core.py", line 148, in setup
      return run_commands(dist)
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\core.py", line 163, in run_commands
      dist.run_commands()
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 967, in run_commands
      self.run_command(cmd)
    File "C:\Program Files\Spyder\pkgs\setuptools\dist.py", line 1229, in run_command
      super().run_command(command)
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 986, in run_command
      cmd_obj.run()
    File "C:\Program Files\Spyder\pkgs\wheel\bdist_wheel.py", line 301, in run
      install = self.reinitialize_command('install',
    File "C:\Program Files\Spyder\pkgs\setuptools\__init__.py", line 142, in reinitialize_command
      cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\cmd.py", line 305, in reinitialize_command
      return self.distribution.reinitialize_command(command,
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 951, in reinitialize_command
      for sub in command.get_sub_commands():
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\cmd.py", line 324, in get_sub_commands
      if method is None or method(self):
    File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\command\install.py", line 756, in has_lib
      return (self.distribution.has_pure_modules() or
  AttributeError: 'NoneType' object has no attribute 'has_pure_modules'
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for src
  error: subprocess-exited-with-error
  
  Running setup.py install for src did not run successfully.
  exit code: 1
  
  [2 lines of output]
  running install
  You've probably made a mistake here and are trying to install from a 'src' directory which doesn't exist.
  [end of output]

I tried to update wheel but it is already up to date.

Looks like you need to install src.

Pip install src

Pyinstaller can't convert a file to an exe if a required packages isn't installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM