anaconda 虚拟环境使用 pyinstaller 打包 32位 exe

发布于 2022-09-12 00:29:54 字数 4560 浏览 20 评论 0

64 位 win10 系统,安装了 anancoda 64 位版本,用 python 写了个程序,准备使用 pyinstaller 打包为一个 exe 给别人使用,使用conda 默认的base 环境打包没有问题,但是有用户使用的是32位的windows系统,打包的64位exe无法运行,因此需要在32位环境下重新打包一份exe,于是在anaconda中创建了一个32位的虚拟环境py32,然后安装好 pyinstaller等必要包之后,开始打包,结果提示:

(py32) C:\Users\...\iHerbarium>pyinstaller iHerbarium.py
125 INFO: PyInstaller: 3.5
125 INFO: Python: 3.7.5
140 INFO: Platform: Windows-10-10.0.18362-SP0
140 INFO: wrote C:\Users\...\iHerbarium.spec
140 INFO: UPX is not available.
140 INFO: Extending PYTHONPATH with paths
['C:\\Users\\...\\iHerbarium',
 'C:\\Users\\...\\iHerbarium']
140 INFO: checking Analysis
140 INFO: Building Analysis because Analysis-00.toc is non existent
140 INFO: Initializing module dependency graph...
156 INFO: Initializing module graph hooks...
156 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "C:\Users\...\Anaconda3\envs\py32\lib\pkgutil.py", line 3, in <module>
    from collections import namedtuple
  File "C:\Users\...\Anaconda3\envs\py32\lib\collections\__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "C:\Users\...\Anaconda3\envs\py32\lib\site-packages\reprlib\__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "C:\Users\...\Anaconda3\envs\py32\lib\pkgutil.py", line 3, in <module>
    from collections import namedtuple
  File "C:\Users\...\Anaconda3\envs\py32\lib\collections\__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "C:\Users\...\Anaconda3\envs\py32\lib\site-packages\reprlib\__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
4939 INFO: running Analysis Analysis-00.toc
4939 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:\Users\...\Anaconda3\envs\py32\python.exe
5486 INFO: Caching module hooks...
5501 INFO: Analyzing C:\Users\...\iHerbarium\iHerbarium.py
5907 INFO: Processing pre-find module path hook   distutils
8689 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "C:\Users\...\Anaconda3\envs\py32\lib\site-packages\setuptools\__init__.py", line 5, in <module>
    import functools
  File "C:\Users\...\Anaconda3\envs\py32\lib\functools.py", line 21, in <module>
    from collections import namedtuple
  File "C:\Users\...\Anaconda3\envs\py32\lib\collections\__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "C:\Users\...\Anaconda3\envs\py32\lib\site-packages\reprlib\__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "C:\Users\...\Anaconda3\envs\py32\lib\site-packages\setuptools\__init__.py", line 5, in <module>
    import functools
  File "C:\Users\...\Anaconda3\envs\py32\lib\functools.py", line 21, in <module>
    from collections import namedtuple
  File "C:\Users\...\Anaconda3\envs\py32\lib\collections\__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "C:\Users\...\Anaconda3\envs\py32\lib\site-packages\reprlib\__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
pre-safe-import-module hook failed, needs fixing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文