问题描述
我正在用 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 环境的搜索路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!