How to do a "compilation" of the code in Python?

2

Knowing that Python is an interpreted language, is there any way to compile the program in Python? By that I mean, how to check for syntax errors without having to expect such a part of the program to occur for verification. Because errors are only shown in terminal or IDE at runtime.

    
asked by anonymous 25.01.2018 / 11:17

1 answer

4

You can only generate bytecode through the modules py_compile and compileall . To use it you need to use -m option:

python -m py_compile arquivo.py
    
25.01.2018 / 11:48