pyinstaller用包安装后使用时出错pkg_resources.DistributionNotFound: The *** distribution was not

pyinstaller生成可执行文件时报错:

C:\Users\骂了隔壁老王\Desktop\MyRestraunt>pyinstaller -F gui_test5.py
Traceback (most recent call last):
  File "C:\python3.7\Scripts\pyinstaller-script.py", line 6, in 
    from pkg_resources import load_entry_point
  File "C:\python3.7\lib\site-packages\pkg_resources\__init__.py", line 3261, in 
    @_call_aside
  File "C:\python3.7\lib\site-packages\pkg_resources\__init__.py", line 3245, in _call_aside
    f(*args, **kwargs)
  File "C:\python3.7\lib\site-packages\pkg_resources\__init__.py", line 3274, in _initialize_master_work
ing_set
    working_set = WorkingSet._build_master()
  File "C:\python3.7\lib\site-packages\pkg_resources\__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "C:\python3.7\lib\site-packages\pkg_resources\__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "C:\python3.7\lib\site-packages\pkg_resources\__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pefile>=2017.8.1' distribution was not found and is required by
 PyInstaller

一开始百度看了很多博客,有说distribute没安装的,还有说pip版本没更新,尝试了之后还是不行,
最后想起来安装pyinstaller的时候因为网络原因pip不能用,选择了手动下载包安装,导致有pyinstaller需要的配置没有安装全

解决办法:重新pip安装pyinstaller;
如果还是网络太慢建议搭梯子;
或者换源

win+r,输入cmd打开终端
输入pip install pqi 后回车
成功后再次输入pqi ls 回车
pyinstaller用包安装后使用时出错pkg_resources.DistributionNotFound: The *** distribution was not_第1张图片
再次输入pqi use aliyun(除了pypi都可以,aliyun只是举个例子)

换源后下载速度就高了
再次pip install pyinstaller完事儿
pyinstaller用包安装后使用时出错pkg_resources.DistributionNotFound: The *** distribution was not_第2张图片

你可能感兴趣的:(python,pip,tkinter)