pyinstaller历来是错误的高发区。

何况叠加embed版本容易出问题。

一步一步还是解决了这个问题。

症状如下图:

  Preparing metadata (setup.py) ... error
  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\Administrator\AppData\Local\Temp\2\pip-install-niriqxor\future_8972a03a11954586bdbb2f62571a18b0\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 details.

C:\Users\Administrator>C:\Soft\Python_3.11x64embed\python.exe -m pip install futrue
Looking in indexes: https://pypi.doubanio.com/simple/
ERROR: Could not find a version that satisfies the requirement futrue (from versions: none)
ERROR: No matching distribution found for futrue

C:\Users\Administrator>C:\Soft\Python_3.11x64embed\python.exe -m pip install future
Looking in indexes: https://pypi.doubanio.com/simple/
Collecting future
  Using cached https://pypi.doubanio.com/packages/8f/2e/cf6accf7415237d6faeeebdc7832023c90e0282aa16fd3263db0eb4715ec/future-0.18.3.tar.gz (840 kB)
  Preparing metadata (setup.py) ... error
  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\Administrator\AppData\Local\Temp\2\pip-install-enx8c9y5\future_562784ac83f74bda80a58ff6c233745d\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 details.

一步一步安装依赖包,最后安装到uture-0.18.3装不下去了。

根据PIP自动下载的地址,下载了uture-0.18.3的源码,发现有这么一句:

import src.future

这是源代码目录的包。于是一不估二不休,直接注释掉,然后把后面引用的直接改成常量如下
VERSION = "0.18.3"
DESCRIPTION = "Clean single-source support for Python 3 and 2"
LONG_DESC = ""

然后最后试试

在cmd下面,cd到源代码目录

运行

<自己的python embed版本的>python.exe setup.py build

<自己的python embed版本的>python.exe setup.py install

安装成功!!!

直接再

<自己的python embed版本的>python.exe -m pip install pyinstaller

成功!!!!!!

BTW,费这么大力,把时间花在不该花的地方,目的就是制造一个完美的绿色版,下次移植就方便了。

而且,其实所有的努力都不会白费,都能提高解决问题的能力。

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐