如何使用 PythonCall CondaPkg Python 安装而不是 PyCall.jl/Conda.jl 来运行 IJulia

问题描述 投票:0回答:1

PythonCall.jl 和 CondaPkg.jl 似乎正变得越来越有用。特别是CondaPkg通过

CondaPkg.toml
提供了管理Python虚拟环境的工具,与
Project.toml
类似,非常方便。

但是,当通过

IJulia
使用 Jupyter Notebook 时,会创建另一个 Python 安装。这导致大量依赖项在 Conda.jl 和 CondaPkg.jl 环境中重复。

如何强制 IJulia 使用现有的

CondaPkg
安装而不是允许它通过 Conda.jl 安装 Jupyter?

python jupyter-notebook julia
1个回答
0
投票

此类配置可以通过以下命令实现:

using CondaPkg
CondaPkg.add("jupyter")
ENV["JUPYTER"] = CondaPkg.which("jupyter")

using Pkg
Pkg.add("IJulia") # if IJulia was not yet installed
Pkg.build("IJulia") # To change the configuration of existing installation

通过此配置,可以避免重复 Python 包并坚持使用

CondaPkg
进行 Python 环境管理。

© www.soinside.com 2019 - 2024. All rights reserved.