【python】pyinstaller打包后运行exe可执行文件出现报错:ImportError: cannot import name ‘tarfile‘ from ‘backports‘

Traceback (most recent call last):
  File "D:\mdwsw\python\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgres.py", line 16, in <module>
    import pkg_resources
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "pkg_resources\__init__.py", line 95, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "jaraco\text\__init__.py", line 12, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "jaraco\context.py", line 17, in <module>
ImportError: cannot import name 'tarfile' from 'backports' (C:\Users\mdwsw\AppData\Local\Temp\_MEI159682\backports\__init__.pyc)

解决方法:

pip install --upgrade pyinstaller

pip install --upgrade setuptools wheel

升级之后就能成功运行了;

你可能感兴趣的:(实用工具,Python,python,linux)