简体   繁体   English

如何为之前版本的 Julia 添加 Jupyter Notebook 内核?

[英]How do you add Jupyter Notebook kernels for prior versions of Julia?

I am using a Windows machine and trying to have Jupyter Notebook kernels for multiple versions of Julia (0.7.0 and 1.1.1) because package AWS does not support the latest version, but does support 0.7.0.我正在使用 Windows 机器并尝试为多个版本的 Julia(0.7.0 和 1.1.1)安装 Jupyter Notebook 内核,因为包 AWS 不支持最新版本,但支持 0.7.0。

I had Julia 1.1.1 installed on my computer first and got something similar to the following error when I tried to install package AWS: https://github.com/JuliaLang/Pkg.jl/issues/792我首先在我的计算机上安装了 Julia 1.1.1,当我尝试安装包 AWS 时出现类似于以下错误的内容: https : //github.com/JuliaLang/Pkg.jl/issues/792

Then I installed Julia 0.7.0 and was able to install AWS in the Julia 0.7.0 terminal with Pkg.add("AWS") with no problems.然后我安装了 Julia 0.7.0,并且能够在 Julia 0.7.0 终端中使用Pkg.add("AWS")地安装 AWS。

In the Julia 0.7.0 terminal, I installed IJulia again with Pkg.add("IJulia") and restarted my Jupyter notebook instance.在 Julia 0.7.0 终端中,我再次使用Pkg.add("IJulia")安装了 IJulia,并重新启动了我的 Jupyter 笔记本实例。 Now I'd like to use AWS via Jupyter notebook but when I create a new one, only Julia 1.1.1 appears.现在我想通过 Jupyter notebook 使用 AWS,但是当我创建一个新的 notebook 时,只会出现 Julia 1.1.1。

没有朱莉娅 0.7.0!

I ended up having success by showing which kernels I had using jupyter kernelspec list in terminal, which showed where my other Julia kernel was located.我最终通过在终端中使用jupyter kernelspec list显示了哪些内核而取得了成功,该jupyter kernelspec list显示了我的另一个 Julia 内核所在的位置。

>>> jupyter kernelspec list
Available Kernels:
  julia-1.1    C:\Users\{%USERNAME%}\AppData\Roaming\jupyter\kernels\julia-1.1
  python3      C:\ProgramData\Anaconda3\share\jupyter\kernels\python3

  1. I navigated to the file path listed after julia-1.1我导航到 julia-1.1 之后列出的文件路径
  2. Created a julia-0.7 folder in that same directory在同一目录中创建了一个 julia-0.7 文件夹
  3. Copied over contents from the julia-1.1 folder复制 julia-1.1 文件夹中的内容
  4. Edited the kernel.json file by replacing every instance of julia-1.1.1 with julia-0.7.0通过用julia-0.7.0替换julia-1.1.1每个实例来编辑 kernel.json 文件

What I ended up having success with seems like a very rudimentary way to solve this problem.我最终成功的方法似乎是解决这个问题的一种非常基本的方法。 I'd like a more elegant way to achieve the same result, similar to when adding multiple kernels for different versions of Python.我想要一种更优雅的方式来实现相同的结果,类似于为不同版本的 Python 添加多个内核时。 ( Using both Python 2.x and Python 3.x in IPython Notebook ) 在 IPython Notebook 中同时使用 Python 2.x 和 Python 3.x

Please help, thank you!请帮忙,谢谢!

You (probably) just need to Pkg.build("IJulia") on the second Julia version.您(可能)只需要在第二个 Julia 版本上使用Pkg.build("IJulia")

Since Julia 0.7 the package manager uses separate directories for each version of a package, meaning that, from the package managers perspective, the package is already installed, and no downloading or building is performed when you install the same version from a different Julia version.从 Julia 0.7 开始,包管理器为包的每个版本使用单独的目录,这意味着,从包管理器的角度来看,包已经安装,当您从不同的 Julia 版本安装相同版本时,不会执行下载或构建。 The package manager does not know, however, that IJulia needs to be rebuilt for this new Julia version.然而,包管理器不知道需要为这个新的 Julia 版本重建IJulia You can trigger the build manually by Pkg.build("IJulia") .您可以通过Pkg.build("IJulia")手动触发构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM