Python 2.7 importing pyc files without py files

Emile van Sebille emile at fenx.com
Wed Feb 19 17:25:41 EST 2014


On 2/19/2014 2:03 PM, Mircescu Andrei wrote:

 > If there are only pyc files, the loading time of the application is
 > much more than if I have pyc and py files. It is behind with 2
 > minutes more than if it had py files

You may get some clues by starting python as

/path/to/python/python2.7 -vv

which will provide the details of attempts to import:

[root at vsds4 log]# python2.7 -vv
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# trying /usr/local/lib/python2.7/site.so
# trying /usr/local/lib/python2.7/sitemodule.so
# trying /usr/local/lib/python2.7/site.py
# /usr/local/lib/python2.7/site.pyc matches /usr/local/lib/python2.7/site.py
import site # precompiled from /usr/local/lib/python2.7/site.pyc
# trying /usr/local/lib/python2.7/os.so
# trying /usr/local/lib/python2.7/osmodule.so
# trying /usr/local/lib/python2.7/os.py
# /usr/local/lib/python2.7/os.pyc matches /usr/local/lib/python2.7/os.py
import os # precompiled from /usr/local/lib/python2.7/os.pyc
...



HTH,

Emile





More information about the Python-list mailing list