簡體   English   中英

在 Python 3 虛擬環境中,我在 site-packages 目錄中添加了一個 mypaths.pth 文件,但 pth 文件中的目錄未添加到 sys.path

[英]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

mypaths.pth 位於以下目錄中:

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

mypaths.pth 包含類似於以下內容的行:

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

這些目錄都存在,但沒有一個被添加到 python 會話中的 sys.path 中。

name.pth 文件在虛擬環境中的使用是否不同? 或者,更基本上,我做錯了什么?

很抱歉把它放在那里以表明我是多么無知。 我把mypaths.pth文件放在虛擬環境結構中,然后在系統級python的終端執行python腳本,即沒有激活我的虛擬環境。 所以,感覺有些尷尬。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM