简体   繁体   中英

When is it necessary to add a folder to sys.path?

In psycopg2's setup.py , there is the following line:

sys.path.insert(0, 'scripts')

The scripts folder is in the same directory as setup.py - why does it need to be added to sys.path ?

That's something quite normal, as it allows the module to import some additional required modules which may be missing from the system. Remember that this change of sys.path is only temporary, while the setup.py is running.

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