pyinstaller打包出错
error:
pkg_resources.DistributionNotFound: The ‘cryptography>=2.1.4’ distribution was not found and is required
解决办法:安装缺少的模块
pip install cryptography
pip install lxml
pip install networkx
pip install future
pyinstaller打包太大
解决办法:用纯净环境安装
#安装
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv
#建立虚拟环境
pipenv install
#进入虚拟环境(上一步可省略,因为没有虚拟环境的话会自动建立一个)
pipenv shell
#安装模块
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas requests opencv-python numpy
#打包的模块也要安装
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller
#开始打包
pyinstaller -Fw -i ***.ico --clean D:\源码软件\Python源码\WindowsAPI\修改windows管理员密码\test1.py
-F: 指只生成一个exe文件,不生成其他dll文件
-w: 不弹出命令行窗口
-i : 设定程序图标 ,其后面的ico文件就是程序图标
--clean: 在构建之前清理PyInstaller缓存并删除临时文件