在Jupyter中配置使用Julia语言

最近了解到Julia是种非常好用的语言,打算学习一下,在 coursera上找到了相应的课程,但是是写在Jupyter中的,只能安装 IJulia 插件,按照要求先是在Julia终端(安装Julia的过程很简单,这里就不介绍了)输入

using Pkg
Pkg.add("IJulia")
结果出现了好像包不能编译的情况如ZMQ,”build ZMQ”出现了下面的错误:
(v1.1) pkg> build ZMQ
  Building ZMQ → `~/.julia/packages/ZMQ/ABGOx/deps/build.log`
┌ Error: Error building `ZMQ`: 
│ ┌ Warning: platform_key() is deprecated, use platform_key_abi() from now on
│ │   caller = ip:0x0
│ └ @ Core :-1
│ ┌ Warning: Could not extract the platform key of https://github.com/JuliaInterop/ZMQBuilder/releases/download/v4.2.5+6/ZMQ.x86_64-apple-darwin14.tar.gz; continuing...
│ └ @ BinaryProvider ~/.julia/packages/BinaryProvider/TcAwt/src/Prefix.jl:185
│ [ Info: Downloading https://github.com/JuliaInterop/ZMQBuilder/releases/download/v4.2.5+6/ZMQ.x86_64-apple-darwin14.tar.gz to /Users/davidbuchaca1/.julia/packages/ZMQ/ABGOx/deps/usr/downloads/ZMQ.x86_64-apple-darwin14.tar.gz...
│ ERROR: LoadError: Could not download https://github.com/JuliaInterop/ZMQBuilder/releases/download/v4.2.5+6/ZMQ.x86_64-apple-darwin14.tar.gz to /Users/davidbuchaca1/.julia/packages/ZMQ/ABGOx/deps/usr/downloads/ZMQ.x86_64-apple-darwin14.tar.gz:
│ ErrorException("")
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] #download#89(::Bool, ::Function, ::String, ::String) at /Users/davidbuchaca1/.julia/packages/BinaryProvider/TcAwt/src/PlatformEngines.jl:498
│  [3] #download at ./none:0 [inlined]
│  [4] #download_verify#90(::Bool, ::Bool, ::Bool, ::Function, ::String, ::String, ::String) at /Users/davidbuchaca1/.julia/packages/BinaryProvider/TcAwt/src/PlatformEngines.jl:567
│  [5] #download_verify at ./none:0 [inlined]
│  [6] #install#129(::Prefix, ::String, ::Bool, ::Bool, ::Bool, ::Function, ::String, ::String) at /Users/davidbuchaca1/.julia/packages/BinaryProvider/TcAwt/src/Prefix.jl:314
│  [7] (::getfield(BinaryProvider, Symbol("#kw##install")))(::NamedTuple{(:prefix, :force, :verbose),Tuple{Prefix,Bool,Bool}}, ::typeof(install), ::String, ::String) at ./none:0
│  [8] top-level scope at /Users/davidbuchaca1/.julia/packages/ZMQ/ABGOx/deps/build.jl:44
│  [9] include at ./boot.jl:326 [inlined]
│  [10] include_relative(::Module, ::String) at ./loading.jl:1038
│  [11] include(::Module, ::String) at ./sysimg.jl:29
│  [12] include(::String) at ./client.jl:403
│  [13] top-level scope at none:0
│ in expression starting at /Users/davidbuchaca1/.julia/packages/ZMQ/ABGOx/deps/build.jl:40
│ [22:31:24] dyld: Library not loaded: @rpath/libssl.1.0.0.dylib
│ [22:31:24]   Referenced from: /Users/davidbuchaca1/anaconda3/lib/libssh2.1.dylib
│ [22:31:24]   Reason: image not found
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075
整整折腾了太半天都没解决,如修改logo文件,切换到管理员权限,重装Julia等等都行不通,包括官网上的方法也不行,最后在CSDN中糖王大王中的一篇文章中找到了方法,原来是要先安装C库,而且只需要安装“MbedTLS”就可全部解决,包括IJulia都安装好了。具体思路就是先用“julia> rm(joinpath(homedir(), “.julia”, “registries”); recursive=true)”删除掉旧的registries,再导入”Pkg”,”julia> import Pkg”,最后安装”MbedTLS”,”julia> Pkg.build(“MbedTLS”)”,三步全部搞定。

如果还是出现上述的问题,可能还需要装一个windows更新Windows Management Framework

Download Windows Management Framework 5.1 from Official Microsoft

安装完成后”using IJulia”,因为电脑原来安装Anaconda3时已经安装了Jupter Notebook了,所以这时只需要打开Jupter Notebook,在首页右上角的”New”下拉菜单上就可以找到新安装的”julia”,打开就可以运行代码了。不需要在Julia终端运行“notebook()”。
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.2.0 (2019-08-20)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(v1.2) pkg> add ZMQ
  Updating registry at `C:\Users\kejunjun\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
  Updating `C:\Users\kejunjun\.julia\environments\v1.2\Project.toml`
 [no changes]
  Updating `C:\Users\kejunjun\.julia\environments\v1.2\Manifest.toml`
 [no changes]
julia>  rm(joinpath(homedir(), ".julia", "registries"); recursive=true)
julia> import Pkg
julia> Pkg.build("MbedTLS")
   Cloning default registries into `C:\Users\kejunjun\.julia`
   Cloning registry from "https://github.com/JuliaRegistries/General.git"
     Added registry `General` to `C:\Users\kejunjun\.julia\registries\General`
 Installed Lazy ──────────────────────────────────── v0.14.0
 Installed FixedPointNumbers ────────── v0.6.1
 Installed Conda ────────────────────────────────── v1.3.0
 Installed FunctionalCollections ── v0.5.0
 Installed Distances ────────────────────────── v0.8.2
 Installed Traceur ────────────────────────────── v0.3.0
 Installed BinaryProvider ──────────────── v0.5.6
 Installed WebIO ────────────────────────────────── v0.8.11
 Installed Requires ──────────────────────────── v0.5.2
 Installed StringDistances ────────────── v0.4.0
 Installed CodeTracking ──────────────────── v0.5.8
 Installed Hiccup ──────────────────────────────── v0.2.2
 Installed Tokenize ──────────────────────────── v0.5.6
 Installed OrderedCollections ──────── v1.1.0
 Installed MbedTLS ────────────────────────────── v0.7.0
 Installed TreeViews ────────────────────────── v0.3.0
 Installed SoftGlobalScope ────────────── v1.0.10
 Installed Juno ──────────────────────────────────── v0.7.2
 Installed Pidfile ────────────────────────────── v1.1.0
 Installed CodeTools ────────────────────────── v0.6.4
 Installed VersionParsing ──────────────── v1.1.3
 Installed URIParser ────────────────────────── v0.4.0
 Installed JSON ──────────────────────────────────── v0.21.0
 Installed Colors ──────────────────────────────── v0.9.6
 Installed Widgets ────────────────────────────── v0.6.2
 Installed LNR ────────────────────────────────────── v0.2.0
 Installed Atom ──────────────────────────────────── v0.10.1
 Installed ColorTypes ──────────────────────── v0.8.0
 Installed WebSockets ──────────────────────── v1.5.2
 Installed IniFile ────────────────────────────── v0.5.0
 Installed HTTP ──────────────────────────────────── v0.8.6
 Installed DataStructures ──────────────── v0.17.1
 Installed Media ────────────────────────────────── v0.5.0
 Installed ZMQ ────────────────────────────────────── v1.0.0
 Installed JuliaInterpreter ──────────── v0.7.3
 Installed MacroTools ──────────────────────── v0.5.1
 Installed Compat ──────────────────────────────── v2.1.0
 Installed Reexport ──────────────────────────── v0.2.0
 Installed Cassette ──────────────────────────── v0.2.6
 Installed DocSeeker ────────────────────────── v0.3.0
 Installed Parsers ────────────────────────────── v0.3.7
 Installed Observables ────────────────────── v0.2.3
 Installed CSTParser ────────────────────────── v0.6.2
 Installed AssetRegistry ────────────────── v0.1.0
 Installed JuliaFormatter ──────────────── v0.1.13
 Installed IJulia ──────────────────────────────── v1.20.0
  Building MbedTLS →→ `C:\Users\kejunjun\.julia\packages\MbedTLS\a1JFn\deps\buil
d.log`
  Building WebIO ────→→ `C:\Users\kejunjun\.julia\packages\WebIO\2mZPb\deps\buil
d.log`
  Building Conda ────→→ `C:\Users\kejunjun\.julia\packages\Conda\kLXeC\deps\buil
d.log`
  Building ZMQ ────────→→ `C:\Users\kejunjun\.julia\packages\ZMQ\ABGOx\deps\buil
d.log`
  Building IJulia ──→→ `C:\Users\kejunjun\.julia\packages\IJulia\fRegO\deps\buil
d.log`
  Building MbedTLS →→ `C:\Users\kejunjun\.julia\packages\MbedTLS\a1JFn\deps\buil
d.log`
false

julia> using IJulia
[ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]