Anaconda设置虚拟环境并打包exe

开发中需要对python编写的程序进行打包,生成exe文件以便未安装python以及库依赖的用户进行使用。由于开发环境中的库文件复杂冗余,打包时导致文件很大,遂考虑在虚拟环境中进行打包。

解决方案:conda + pyinstaller

过程:

  conda create --name work_space python=3.6

  conda activate

  conda install packages

  conda install pyinstaller == pip install pyinstaller

  pyinstaller -Fw C:UserDocumentspyinstallocr.py  # 打包完成  

  conda deactivate  #关闭虚拟环境

  conda delete -n work_space --all  #删除一个已有环境

  conda env list

  conda list  #查看环境列表以及包列表

  

原文地址:https://www.cnblogs.com/vilogy/p/12330944.html