Why are main runnable Python scripts not compiled to pyc files like modules?

后端 未结 2 1768
萌比男神i
萌比男神i 2020-11-28 05:54

I understand that when you import a module, that file is compiled into a .pyc file to make it faster? Why is the main file also not compiled to a .pyc

2条回答
  •  时光取名叫无心
    2020-11-28 06:38

    Compiling the main script would be annoying for scripts in e.g. /usr/bin. The .pyc file is generated in the same directory, thus polluting the public location.

提交回复
热议问题