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 环境的搜索路径


- python-m http.server 443--使用SSL? 2022-01-01
- 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01
- padding='same' 转换为 PyTorch padding=# 2022-01-01
- 沿轴计算直方图 2022-01-01
- python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01
- 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01
- 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
- 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
- 如何将一个类的函数分成多个文件? 2022-01-01
- pytorch 中的自适应池是如何工作的? 2022-07-12