简体   繁体   中英

In a Python 3 virtual environment I have added a mypaths.pth file within the site-packages dir but the dirs in the pth file are not added to sys.path

The mypaths.pth is in the following directory:

main>venv>lib>python3.8>site-packages>mypaths.pth

mypaths.pth includes lines similar to the following:

/home/user/dev/modules/lib/
/home/user/dev/modules/entity/
/home/user/dev/myConfig/

The directories all exist, but none of them are added to the sys.path in the python sessions.

Is the use of a name.pth file different in a virtual environment? Or, more basically, what am I doing wrong?

Sorry to put this out there to show how ignorant I was being. I put the mypaths.pth file in the virtual environment structure and then executed the python scripts by a terminal in the system level python, ie without activating my virtual environment. So, feeling a little embarrassed.

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