Extensions . pyc . pyd . Pyo in Python

Asked

Viewed 6,502 times

5

Since there are certain extensions .pyc, .pyd, .pyo besides the .py in Python, what are the main differences between them? What each one represents?

2 answers

7


  • .py: usually the input source code you wrote.
  • .pyc: is the bytecode compiled. If you import a module Python will build a file *.pyc containing the bytecode to make it easier and faster
  • .pyo: is a *.pyc file that has been created with activated optimizations (-O)
  • .pyd: is basically a Windows dll file.
  • .pyw: Python script for Windows. Runs with pythonw.exe
  • .pyx: Cython font to be converted to C/C++
  • .pxd: Cython script which is equivalent to a C/C heading++
  • .pxi: Mypy stub
  • .pyi: file of stub (PEP 484)
  • .pyz: file of scripts Python (PEP 441); Contains scripts Python (ZIP) compressed in binary form after the header of script python pattern
  • .pywz: file of script Python for MS-Windows (PEP 441); Contains scripts Python (ZIP) compressed in binary form after the header of script python pattern

Sources in OS responses of Bill Lynch and by Devyn Collier Johnson.

3

.py is usually the code written by yourself.

.pyc is the compiled binary code. If you import a module, Python will generate a *.pyc file that contains the binary to make it easier (and faster) to import the same module again.

.pyo same as the file .pyc but created when optimizations (-0) were linked.

.pyd is basically a windows dll file (more Infos HERE)

If you want more information about the difference between . Pyo and . pyd, give a look here

Source: ONLY THE GRINGO

Browser other questions tagged

You are not signed in. Login or sign up in order to post.