ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

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

2021-11-27 22:00:08  阅读:271  来源: 互联网

标签:Building wheel pyinstaller easy ... setup py future install


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'文件

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

log可以看到它的egg

 修改完如下;

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

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

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

又报错

 最开始以为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还是方便很多。

标签:Building,wheel,pyinstaller,easy,...,setup,py,future,install
来源: https://blog.csdn.net/kingsai2012/article/details/121583808

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有