Use Py2exe to turn python files into exe files (and error: [Errno 2] No such file or directory: ' MSVCP90.dll ' workaround)

Source: Internet
Author: User

Writing a program in Python is really simple, and when we develop a feature, especially a Python program with a form, you need to turn the Python program into a double-click EXE program. We need a third-party module Py2exe, which is the module that turns the PY into EXE. Just py2exe How to install, I do not elaborate here, directly to the official web download corresponding to the Py2exe version of Python, and then a fool-type installation, and installed after the Py2exe module is automatically added to the path of Python.

And then it's easy, we're going to create a new setup.py file under the Py file directory to be converted to EXE and paste the code in:

#coding=utf-8fromimport setupimport py2exesetup(console=["要转换的py文件名"])

Then open cmd and run the setup.py file:

D:\EclipseProjects\Learn>python setup.py py2exe

The following hints appear to indicate success:

You can then find a Dist folder in the current directory, below the exe file of your original conversion file.

If you encounter an error:

2fileordirectory‘MSVCP90.dll‘

Modify the script in the setup.py file as follows:

#coding=utf-8fromimport setupimport py2exe# setup(console=["chapter13.py"])setup(windows=["chapter13.py""py2exe":{"dll_excludes":["MSVCP90.dll"]}})

And then follow the original method of execution, you can succeed. The reason should MSVCP90.dll not be found. This problem typically occurs after you use a program that has a form.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Use Py2exe to turn python files into exe files (and error: [Errno 2] No such file or directory: ' MSVCP90.dll ' workaround)

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.