简体   繁体   中英

Python: How to switch off scanning of the lib directories at start

I have installed my own python with 10000 additional modules. Both the python and the modules are located on a small NFS share. When I start the python it scans all its library directories and looks for available modules. It takes several seconds.

How I can explicitly switch this scanning process off?

You can start the Python interpreter with the -S flag. This means site.py won't run and that won't scan for all the installed Python modules. The benefit is that Python will start faster, the downside is that many modules won't be included in your sys.path and you won't be able to import them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM