How to add folder to search path for a given Anaconda environment?(如何将文件夹添加到给定 Anaconda 环境的搜索路径?)
问题描述
我正在用 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 环境的搜索路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将文件夹添加到给定 Anaconda 环境的搜索路径


基础教程推荐
- 合并具有多索引的两个数据帧 2022-01-01
- 使 Python 脚本在 Windows 上运行而不指定“.py";延期 2022-01-01
- Python 的 List 是如何实现的? 2022-01-01
- 症状类型错误:无法确定关系的真值 2022-01-01
- 使用Python匹配Stata加权xtil命令的确定方法? 2022-01-01
- 使用 Google App Engine (Python) 将文件上传到 Google Cloud Storage 2022-01-01
- 哪些 Python 包提供独立的事件系统? 2022-01-01
- 如何在 Python 中检测文件是否为二进制(非文本)文 2022-01-01
- 如何在Python中绘制多元函数? 2022-01-01
- 将 YAML 文件转换为 python dict 2022-01-01