构建/宿主环境
要创建构建和托管环境以及构建脚本,请转到您的配方目录并使用
conda debug /path/to/your/recipe-directory
如记录的here。这将打印一条指导性消息,例如
################################################################################
Build and/or host environments created for debugging. To enter a debugging environment:
cd /home/UserName/miniconda3/conda-bld/debug_1542385789430/work && source /home/UserName/miniconda3/conda-bld/debug_1542385789430/work/build_env_setup.sh
To run your build, you might want to start with running the conda_build.sh file.
################################################################################
(该消息可能错误地告诉您它创建了一个测试环境。)您的源代码已复制到.../work 目录,并且还有一个conda_build.sh 脚本。请注意,采购build_env_setup.sh 将同时加载构建和宿主环境。
您可以处理您的代码和配方并使用conda_build.sh 进行构建,但据我所知,您不会得到合适的 conda 包。完成后可以remove the debug environment:
conda deactivate # maybe twice
conda build purge
测试环境
要获得测试环境,您必须先构建包,然后再对其进行调试。这可能有助于修复您的测试文件。
conda build /path/to/your/recipe-directory # creates mypackage*.tar.bz2
# find file location of mypackage*.tar.bz2 with:
conda search --info --use-local mypackage # look at the url row for the path
cd /path/to/miniconda3/conda-bld/linux-64/ # go to that path, can be different
conda debug mypackage*.tar.bz2
这将打印 e。 g.:
################################################################################
Test environment created for debugging. To enter a debugging environment:
cd /home/UserName/miniconda3/conda-bld/debug_1542385789430/test_tmp && source /home/UserName/miniconda3/conda-bld/debug_1542385789430/work/conda_test_env_vars.sh
To run your tests, you might want to start with running the conda_test_runner.sh file.
################################################################################
再次,删除
conda deactivate
conda build purge
运行环境
这实际上是没有调试,而是构建和安装本地包的一般过程。使用运行环境,您可以检查是否在 requirements/run 部分中指定了所有依赖项。 pinning 也可能是个问题。
(base) $ conda build /path/to/your/recipe-directory
(base) $ conda create --name package-env --use-local mypackage
(base) $ conda activate package-env
(package-env) $ python
>>> import mypackage
您还可以使用 (man page) 列出您的包的依赖项
conda search --info --use-local mypackage
最后提示:如果您想知道依赖项的版本并查看 pinning 是否有效,请尝试 (man page)
conda render /path/to/your/recipe-directory