How to make pyinstaller not use anaconda and build a small-size exe file

后端 未结 2 1151
别那么骄傲
别那么骄傲 2020-12-10 23:09

I have been trying to build .exe file using pyinstaller in windows 10. It worked, but the size of the exe file is ~212 MB, even by using a venv (as in here). I thought it mi

相关标签:
2条回答
  • 2020-12-10 23:30

    Finally, after a lot of researching, could solve my problem:

    • Uninstalled all pythons and anaconda from my PC
    • Removed all Path from the system variables
    • Restarted the windows
    • Installed a fresh Python from its website
    • Installed Pyinstaller using pip install pyinstaller
    • Tested my .py code in cmd. It showed me all the packages that are missing.
    • Installed all required packages by using pip install name-of-package
    • Ran final command by pyinstaller -F -w --clean file.py
    • (Optional) Install Anaconda if you need (don't add Anaconda Python as the default python. Also don't add its path to the system variables).

    Note: You can build virtualenv and do pyinstaller in them.

    My previous tries which used anaconda resulted in file of 212 MB in size. This process generated a .exe file of size 27 MB (Importing only pandas module).

    0 讨论(0)
  • 2020-12-10 23:36

    I ran into a similar problem and found PyCharms virtualenv manager very helpful. https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html

    This just necessitated downloading python from python.org and linking the virtual environment to this interpreter, rather than the conda interpreter (otherwise it will throw strange SSL errors).

    This seems to allow neat parallel use of conda and virtualenv.

    0 讨论(0)
提交回复
热议问题