pipenv pyinstaller 打包

起因: 本地安装的模块太多,使用pyinstaller 打包,会把许多无关模块打进去.

解决:使用pipenv创建虚拟环境进行打包

  • pip install pipenv 安装pipenv
  • pipenv install --python 3.5 安装指定python版本的虚拟环境
  • pipenv shell 命令行激活环境
  • 安装依赖库
  • 执行打包

注: 执行pipenv install pipenv 时的所在目录会生成1个Pipfile 文件,
我执行 pipenv shell后,后面我cd到项目的目录,去打包文件,看打包的信息
是用的本地信息打包,然后我cd回原目录才正常打包

  • pip freeze > requirements.txt 导出刚刚安装的包

猜你喜欢

转载自www.cnblogs.com/wanderingfish/p/12022567.html