python Building wheel for future (setup.py) ... error

pip install pyinstaller 时报如下错误:

Collecting future
  Using cached future-0.18.2.tar.gz (829 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: future
  Building wheel for future (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:....省略

核心的问题错误就是涂红色这两行,就是说building wheel for future 时错误了,找了很多贴子,都是手动下载whl 然后在安装的,其实在我测试手动下载后安装也会报错,不过报的错误是

creating dist
creating 'dist\future-0.18.2-py3.10.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing future-0.18.2-py3.10.egg
removing 'd:\python310\lib\site-packages\future-0.18.2-py3.10.egg' (and everything under it)
creating d:\python310\lib\site-packages\future-0.18.2-py3.10.egg
Extracting future-0.18.2-py3.10.egg to d:\python310\lib\site-packages
Adding future 0.18.2 to easy-install.pth file
error: [Errno 22] Invalid argument: 'd:\\python310\\lib\\site-packages\\easy-install.pth'

最后这一行报无效的参数,其实安装过程还是成果了,接最后没有写到easy-install.pth中,猜想如果没有写进去,其它程序调用easy-install 时同样还出错,好像是pip调用的就是easy-install.

既然你没有写进去,是不是可以手动写进去了?

查看'd:\\python310\\lib\\site-packages\\easy-install.pth'文件

python Building wheel for future (setup.py) ... error

 果然没有future文件,参考如上这个格式,把它手动添加进去

log可以看到它的egg

python Building wheel for future (setup.py) ... error

 修改完如下;python Building wheel for future (setup.py) ... error

 再安装 pip install future,果然显示已经安装成果了

python Building wheel for future (setup.py) ... error

 此时再pip install pyinstaller (install 其它包同样会有这问题,简单的不依耐future和pefile的能正常安装)很快就成功了。

python Building wheel for future (setup.py) ... error

 反向测试,去掉手动修改的easy-install.pth部分

又报错

python Building wheel for future (setup.py) ... error

 最开始以为python cmd才有这问题,在pycham里安装同样会报错

Collecting pyinstaller
  Using cached pyinstaller-4.7-py3-none-win_amd64.whl (2.0 MB)
Collecting altgraph
  Using cached altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Collecting pywin32-ctypes>=0.2.0
  Using cached pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)
Collecting pyinstaller-hooks-contrib>=2020.6
  Using cached pyinstaller_hooks_contrib-2021.3-py2.py3-none-any.whl (200 kB)
Requirement already satisfied: pefile>=2017.8.1 in d:\python310\lib\site-packages\pefile-2021.9.3-py3.10.egg (from pyinstaller) (2021.9.3)
Requirement already satisfied: setuptools in d:\python310\lib\site-packages (from pyinstaller) (59.3.0)
Collecting future
  Using cached future-0.18.2.tar.gz (829 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: future
  Building wheel for future (setup.py): started
  Building wheel for future (setup.py): finished with status 'error'
  Running setup.py clean for future
Failed to build future
Installing collected packages: future, pywin32-ctypes, pyinstaller-hooks-contrib, altgraph, pyinstaller
    Running setup.py install for future: started
    Running setup.py install for future: finished with status 'error'

  ERROR: Command errored out with exit status 1:
   command: 'D:\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] 

总结:整个pyinstaller 不能安装成功的原因是缺少future库的支持,而手动安装future库最后也报错,没有写入到easy-install.pth文件中

        因此打破链路的重点就是手动加入到easy-install中。

此时无论在cmd使用pip安装还是使用pycham安装都不会错。

就这么简单的问题,折腾了一下午,好久没用python,想再用用,结果出错,重新安装版本,重启电脑,更新pip,wheel,手动下载然后用setup安装都试过了!

吃一暂长一智,希望后面的同学能参考,不要总是手动去安装了,pip还是方便很多。

上一篇:端口存活判断(TCP connect、TCP SYN、TCP FIN和UDP的区别)


下一篇:继续尝试Simswap 512