Python file. py. pyc. Pyw. Pyo. PYD

Source: Internet
Author: User

DLL filethatDynamic Link library files, is aExecutable file, which allows programs to share executionSpecial TasksThe required code and other resources. I can't open it, but I can use it.Disassembly;PYD is aPythondynamic modules. Essentially DLL files, just changed the suffix to PYD,PYD: Extension module, generally written in C or C + + , in fact, it can be said to be a better D language written.

From: http://my.oschina.net/renwofei423/blog/17404
Python is generally considered to be an explanatory language, but this is not true, and in fact, Python will first compile the source code in the. py file into a

Python's byte code (bytecode), which is then executed by Python Virtual machine to execute the compiled byte code. The basic idea of this mechanism is with java,.net

is the same. However, Python virtual machine differs from Java or. NET virtual machine in that Python's virtual machine is a more advanced

Virtual Machine. The high-level here is not the usual high-level, not that Python's virtual machine is more powerful than Java or. NET, but rather that

Compared to Java or. NET, Python's virtual machine is farther away from the real machines. Or so to speak, Python's virtual machine is an abstraction level

Higher virtual machine.
Python should provide a mechanism to save compiled intermediate results, that is, byte code, or, more precisely, to save Pycodeobject. In fact, Python does provide
A mechanism such as the--pyc file.
After executing the source code in a. py file, Python does not automatically generate the. pyc file that corresponds to the. py file. We need to trigger python ourselves to create the PYc file.

Here's a way to make Python create a pyc file, but it's simple to take advantage of the Python import mechanism.
In the process of running Python, if you encounter import ABC, such a statement, then Python will go to the set path to look for Abc.pyc or abc.dll files, if there is no such

Files, and just discover abc.py, Python will first compile the abc.py into the corresponding Pycodeobject intermediate result, then create the Abc.pyc file and the intermediate

The result is written to the file. Next, Python does an import action on the Abc.pyc file, which in effect re-abc.pyc the Pycodeobject in the file.

Copy it in the Save

The following is a python-related file extension, originating from: Http://proupy.com/news/33


The first is our most common. py file. files with the. py extension are source code files that are interpreted by Python.exe and can be run under the console. Of course, you can also use a text editor to enter

Line modification.


the next step is to introduce the. pyc file. the. pyc extension is a python-compiled file. The. pyc file cannot be edited like a text editor, but it's also

The advantage is that the. pyc file executes faster than the. py file. As to why there is a. pyc file, this requirement is too obvious, because the py file is directly visible to the source, if

If you are developing commercial software, it is impossible to disclose the source code. So it needs to be compiled into PYc and then released.


the next step is to introduce the. pyw file. Many of the students who have used the. pyc file know that the. pyc file executes when the desktop appears in a dusky window, sometimes it is very difficult

Look at that. So the. pyw file came into being. The. pyw file is essentially no different from the. pyc file, except that. The black window does not appear when the PYW executes: The PYW format is mainly

is a purely graphical interface program designed to run the development process. Users of the Pure graphical interface program do not need to see the console window. It is worth mentioning that the development of a pure graphical interface program

, you can temporarily change the. pyw to. py so that the runtime can bring up the console window and see all the error messages for easy modification.


the next step is to introduce the. pyo file. PYO is the optimized compiled program. The source program can be compiled into a pyo file by python-o the source file. The same. pyo files are also not available

Edited by this editor.


Finally, the. pyd file is described. . Pyd files are not written in Python, and. Pyd files are typically Python extensions written in other languages. (previously seen on the internet

The. Pyd file is written in a certain format in the D language and processed into a binary file. So what is D language ?? It is a comprehensive, evolutionary version of C + +, not only

Has all the advantages of both, and the overall performance is better, but its high degree of abstraction. )


Python file. py. pyc. Pyw. Pyo. PYD

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.