Python file goto exe

Source: Internet
Author: User
Tags imagemagick

. py file to exe file

1. Software Description:

Using Python to write a video processing software, the library used is moviepy

2. The software used:

Python 3.6.5 32-bit

Pycharm dedicated python editing IDE, recommended for use with

Pyinstaller

ImageMagick.exe (remember his installation path, which will be used later)

Note: Remember to install the 32-bit Python, because 32-bit python on the 64-bit system to package the EXE files can be run on 32 and 64-bit systems, and vice versa. I am the first to install the 64, and then rely on all installed to find that need 32, and all remove the heavy clothes, the heart is very tired

3. Dependencies required for installation:

Installing MOVIEPY:PIP Install Moviepy

Installed imagemagic may still error, can not find the wrong, execute the following command can be resolved: Pip install python-magic-bin==0.4.14

Installing REQUESTS:PIP Install Requests

Installing the Eyed3:pip install EYED3 (I use this dependency, do not have to pretend)

Install the Packaging tool Pyinstaller:pip install Pyinstaller

Packing command: Pyinstaller–f–p moviepy; demo1.py

Parameter description:-F package into a file

-P Pack the Moviepy folder in

4. Problems encountered

4.1 Under Windows Python does not automatically recognize the ImageMagick installation directory and must be manually modified,

Modifying the installation directory for Python lib/site-packages/moviepy/config_defaults.py to Imagemagic

Imagemagick_binary = r "C:\Program Files\imagemagick-6.7.3-q16\convert.exe"

4.2 After packing with Pyinstaller error: Moviepy.audio.fx.all has no attribute of Audio_fadein

Solution: Copy the Python/lib/sitepackages/moviepy folder to the directory where demo1.py is located, modify the __init__.py file under Moviepy/audio/fx/all

Comment out the exec sentence, and then specify the package that was introduced, because Pyinstaller does not recognize exec in this way,

Change to 1, and then add-P moviepy when you pack, and you can solve the problem

Figure 1

4.3 Error: Libmagic not found. The magic depends on the installation, but pyinstaller when packaging, you must place in the. Py folder C:\python32\Lib\site-packages\ Magic under the Libmagic folder and magic.py files, packaged EXE file also have these two things, that is, 2 is shown. To modify the magic.py 156 lines, Bin_dist_path = Os.path.join (Os.path.dirname (__file__), ' libmagic ')

Modified to Bin_dist_path = Os.path.join (Os.path.dirname (sys.executable), ' libmagic ')

Figure 2

Once this is all done, the packaged EXE files can be run on WINDOWS32 and 64-bit systems.

Write in the last words: the author in order to solve 4.2 of the problem in the online search for 3 days, refer to https://github.com/Zulko/moviepy/issues/263 under the pratikone answer to solve, so please cherish the fruits of labor, reproduced please indicate the source

Python file goto exe

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.