問題描述
我正在用 Python 開發一個項目,我想包含一些自己的模塊,這些模塊不在常規 Python 搜索路徑中,我想添加它們.但是,我只想為我在開發期間使用的 Anaconda 環境執行此操作,并且我希望它們隨著時間的推移保持在那里(即,當我重新啟動環境時,我希望搜索路徑具有該文件夾).
I am developing a project in Python and I want to include some own modules which are not on the regular Python search path and I want to add them. However, I want to do this just for the Anaconda environment I am using during development and I would like them to remain there over time(i.e. when I restart the environment, I want the search path to have that folder).
謝謝!
推薦答案
可以用
conda develop <directory>
這會將 conda.pth
文件寫入環境的 site-packages 目錄,這將導致您的目錄添加到 sys.path
.
This will write a conda.pth
file to the environment's site-packages directory which will cause your directory to be added to the sys.path
.
這篇關于如何將文件夾添加到給定 Anaconda 環境的搜索路徑?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!