julia1.0怎样正常add包。我add Plots时,有如下错误:
(v1.0) pkg> add Plots
ERROR: The following package names could not be resolved:
* Plots (not found in project, manifest or registry)
Please specify by known `name=uuid`.
(v1.0) pkg> add Plots
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Installed Plots ─ v0.18.0
我是好的,你
(v1.0) pkg> up
试一下?
这是我up之后的结果:
(v1.0) pkg> up
Resolving package versions...
为什么我up之后,接着add Plots还是报错啊?
你是在Windows上吗?那这个呢?
add Example
Windows的话看谁可以重复一下这个错误吧,我系统和你不一样,我这里是好的。我觉得也许是一个bug。
哦哦,我是在win10的环境下操作的。我安装上1.0之后,add普通的包都是类似的错误
你可以运行一下以下的命令然后把结果打印出来吗?我可以帮你报一个issue或者去英文discourse上问一下
julia> using InteractiveUtils
julia> versioninfo()
然后在pkg mode里面
pkg> status
把以上的打印结果发一下吧
julia> using InteractiveUtils
julia> versioninfo()
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
(v1.0) pkg> status
Status `C:\Users\luk\.julia\environments\v1.0\Project.toml`
[28b8d3ca] GR v0.32.2
[91a5bcdd] Plots v0.18.0
(v1.0) pkg>
我在using Plots时出现错误:
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
WARNING: could not import Base.linspace into Colors
ERROR: LoadError: LoadError: UndefVarError: endof not defined
Stacktrace:
[1] getproperty(::Module, ::Symbol) at .\sysimg.jl:13
[2] top-level scope at none:0
[3] include at .\boot.jl:317 [inlined]
[4] include_relative(::Module, ::String) at .\loading.jl:1038
[5] include at .\sysimg.jl:29 [inlined]
[6] include(::String) at C:\Users\luk\.julia\packages\Plots\mqUvK\src\Plots.jl:3
[7] top-level scope at none:0
[8] include at .\boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at .\loading.jl:1038
[10] include(::Module, ::String) at .\sysimg.jl:29
[11] top-level scope at none:2
[12] eval at .\boot.jl:319 [inlined]
[13] eval(::Expr) at .\client.jl:389
[14] top-level scope at .\none:3 in expression starting at
C:\Users\luk\.julia\packages\Plots\mqUvK\src\types.jl:90 in expression starting at
C:\Users\luk\.julia\packages\Plots\mqUvK\src\Plots.jl:156
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to
C:\Users\luk\.julia\compiled\v1.0\Plots\ld3vC.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] macro expansion at .\logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1184
[4] _require(::Base.PkgId) at .\logging.jl:311
[5] require(::Base.PkgId) at .\loading.jl:852
[6] macro expansion at .\logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at .\loading.jl:834
我现在可以成功add了,但是using Plots时出错了:
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
WARNING: could not import Base.linspace into Colors
ERROR: LoadError: LoadError: UndefVarError: endof not defined
Stacktrace:
[1] getproperty(::Module, ::Symbol) at .\sysimg.jl:13
[2] top-level scope at none:0
[3] include at .\boot.jl:317 [inlined]
[4] include_relative(::Module, ::String) at .\loading.jl:1038
[5] include at .\sysimg.jl:29 [inlined]
[6] include(::String) at C:\Users\luk\.julia\packages\Plots\mqUvK\src\Plots.jl:3
[7] top-level scope at none:0
[8] include at .\boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at .\loading.jl:1038
[10] include(::Module, ::String) at .\sysimg.jl:29
[11] top-level scope at none:2
[12] eval at .\boot.jl:319 [inlined]
[13] eval(::Expr) at .\client.jl:389
[14] top-level scope at .\none:3 in expression starting at
C:\Users\luk\.julia\packages\Plots\mqUvK\src\types.jl:90 in expression starting at
C:\Users\luk\.julia\packages\Plots\mqUvK\src\Plots.jl:156
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to
C:\Users\luk\.julia\compiled\v1.0\Plots\ld3vC.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] macro expansion at .\logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1184
[4] _require(::Base.PkgId) at .\logging.jl:311
[5] require(::Base.PkgId) at .\loading.jl:852
[6] macro expansion at .\logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at .\loading.jl:834
Plots还没有更新到1.0。我也无法在加载Plots。如果现在就想体验的话建议使用0.7或者0.6.
噢噢,那就行。我以为是别的问题。那我等等就行:grinning:
新的Pkg文档
新的Pkg允许从GitHub的某一个commit直接安装。比如
https://github.com/ontouchstart/Plots.jl/commit/55ee64b4e650fa14fee600cb6c8db19d1d80ad92
语法如下
(v1.0) pkg> add https://github.com/ontouchstart/Plots.jl#55ee64b4e650fa14fee600cb6c8db19d1d80ad92
可惜这个版本还不能完全工作。
但是因为可以在自己的clone里工作,修起来不难。(我没有时间了,等他们升级)
愿意参与的朋友可以自己去PR:
给大家看个好玩的东西
bash-3.2$ docker run --rm -it ontouchstart/work_julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
_/ |\__'_|_|_|\__'_| | Commit 5d4eaca0c9 (1 day old master)
|__/ |
(v1.0) pkg> add https://github.com/JuliaPlots/Plots.jl#340cd0a1fe8bdddfb078e9fbd93d8cf4995cb134
Cloning default registries into /root/.julia/registries
Cloning registry General from "https://github.com/JuliaRegistries/General.git"
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Cloning git-repo `https://github.com/JuliaPlots/Plots.jl`
Updating git-repo `https://github.com/JuliaPlots/Plots.jl`
Resolving package versions...
Installed SortingAlgorithms ─ v0.3.1
Installed FixedPointNumbers ─ v0.5.2
Installed Requires ────────── v0.5.2
Installed RecipesBase ─────── v0.4.0
Installed Colors ──────────── v0.9.0
Installed ColorTypes ──────── v0.7.3
Installed NaNMath ─────────── v0.3.2
Installed Compat ──────────── v1.0.1
Installed Measures ────────── v0.2.0
Installed StatsBase ───────── v0.25.0
Installed StaticArrays ────── v0.8.3
Installed DataStructures ──── v0.11.0
Installed Showoff ─────────── v0.2.1
Installed Missings ────────── v0.3.0
Installed JSON ────────────── v0.19.0
Installed PlotThemes ──────── v0.3.0
Installed Reexport ────────── v0.2.0
Installed PlotUtils ───────── v0.5.1
Installed Contour ─────────── v0.5.0
Installed GR ──────────────── v0.32.2
Updating `~/.julia/environments/v1.0/Project.toml`
[91a5bcdd] + Plots v0.18.0+ #340cd0a (https://github.com/JuliaPlots/Plots.jl)
Updating `~/.julia/environments/v1.0/Manifest.toml`
[3da002f7] + ColorTypes v0.7.3
[5ae59095] + Colors v0.9.0
[34da2185] + Compat v1.0.1
[d38c429a] + Contour v0.5.0
[864edb3b] + DataStructures v0.11.0
[53c48c17] + FixedPointNumbers v0.5.2
[28b8d3ca] + GR v0.32.2
[682c06a0] + JSON v0.19.0
[442fdcdd] + Measures v0.2.0
[e1d29d7a] + Missings v0.3.0
[77ba4419] + NaNMath v0.3.2
[ccf2f8ad] + PlotThemes v0.3.0
[995b91a9] + PlotUtils v0.5.1
[91a5bcdd] + Plots v0.18.0+ #340cd0a (https://github.com/JuliaPlots/Plots.jl)
[3cdcf5f2] + RecipesBase v0.4.0
[189a3867] + Reexport v0.2.0
[ae029012] + Requires v0.5.2
[992d4aef] + Showoff v0.2.1
[a2af1166] + SortingAlgorithms v0.3.1
[90137ffa] + StaticArrays v0.8.3
[2913bbd2] + StatsBase v0.25.0
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8bb1440f] + DelimitedFiles
[8ba89e20] + Distributed
[b77e0a4c] + InteractiveUtils
[76f85450] + LibGit2
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[56ddb016] + Logging
[d6f4376e] + Markdown
[a63ad114] + Mmap
[44cfe95a] + Pkg
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA
[9e88b42a] + Serialization
[1a1011a3] + SharedArrays
[6462fe0b] + Sockets
[2f01184e] + SparseArrays
[10745b16] + Statistics
[8dfed614] + Test
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
Building GR ───→ `~/.julia/packages/GR/crXzk/deps/build.log`
Building Plots → `~/.julia/packages/Plots/8ptoM/deps/build.log`
(v1.0) pkg> add UnicodePlots
Resolving package versions...
Installed UnicodePlots ─ v0.3.0
Updating `~/.julia/environments/v1.0/Project.toml`
[b8865327] + UnicodePlots v0.3.0
Updating `~/.julia/environments/v1.0/Manifest.toml`
[b8865327] + UnicodePlots v0.3.0
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
WARNING: could not import Base.linspace into Colors
[ Info: Precompiling GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71]
julia> using UnicodePlots
[ Info: Precompiling UnicodePlots [b8865327-cd53-5732-bb35-84acbb429228]
WARNING: using UnicodePlots.annotate! in module Main conflicts with an existing identifier.
WARNING: using UnicodePlots.xlabel! in module Main conflicts with an existing identifier.
WARNING: using UnicodePlots.ylabel! in module Main conflicts with an existing identifier.
WARNING: using UnicodePlots.spy in module Main conflicts with an existing identifier.
WARNING: using UnicodePlots.title! in module Main conflicts with an existing identifier.
WARNING: using UnicodePlots.histogram in module Main conflicts with an existing identifier.
julia> unicodeplots()
Plots.UnicodePlotsBackend()
julia> x = 0:2π/200:2π; y = sin.(x);
julia> plot(x, y)
┌────────────────────────────────────────────────────────────┐
2 │⠀⠀⠀⠀⠀⠀⠀⢰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ y1
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⢀⡴⠚⠉⠉⠉⠉⠙⠲⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⣠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⢀⠜⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⡰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠉⠉⠉⠉⠉⠉⠉⢹⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⡍⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⡹⠋⠉⠉⠉⠉⠁│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠜⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠃⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠢⣄⣀⣀⣀⣀⡤⠖⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
-2 │⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
└────────────────────────────────────────────────────────────┘
-1 7
julia>
因为这是在docker terminal 里面,我用这个包作为后台:GitHub - JuliaPlots/UnicodePlots.jl: Unicode-based scientific plotting for working in the terminal
好了,最后一次更新,和大家分享一个hack。这是我的一个fork (没有merge upstream 的意图,只是好玩而已)。
这个hack的目的是把现有的包 GitHub - JuliaPlots/UnicodePlots.jl: Unicode-based scientific plotting for working in the terminal 打到Example.jl 包里,
https://github.com/ontouchstart/Example.jl/tree/UnicodePlotsDemo
用法见
https://github.com/ontouchstart/Example.jl/blob/UnicodePlotsDemo/README.md
截屏在这里: