PyPlot add 和 build 没有出错,但是 test 出错,不能画图

版本

Julia Version 1.3.0
Commit 46ce4d7933 (2019-11-26 06:09 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "C:\Users\AAA\AppData\Local\atom\app-1.42.0\atom.exe"  -a
  JULIA_NUM_THREADS = 6

安装

(v1.3) pkg> add PyPlot
  Updating registry at `C:\Users\AAA\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed GLFW_jll ─────── v3.3.0+1
 Installed ArrayInterface ─ v2.2.0
 Installed GLFW ─────────── v3.2.0
 Installed PyPlot ───────── v2.8.2
 Installed PyCall ───────── v1.91.2
  Updating `C:\Users\AAA\.julia\environments\v1.3\Project.toml`
  [d330b81b] + PyPlot v2.8.2
  Updating `C:\Users\AAA\.julia\environments\v1.3\Manifest.toml`
  [4fba245c] ↑ ArrayInterface v2.1.0 ⇒ v2.2.0
  [9e28174c] - BinDeps v1.0.0
  [631607c0] - CMake v1.1.2
  [8f4d0f93] + Conda v1.3.0
  [f7f18e0c] ↑ GLFW v3.1.0 ⇒ v3.2.0
  [0656b61e] + GLFW_jll v3.3.0+1
  [b964fa9f] + LaTeXStrings v1.0.3
  [438e738f] + PyCall v1.91.2
  [d330b81b] + PyPlot v2.8.2
  [81def892] + VersionParsing v1.2.0
  Building PyCall → `C:\Users\AAA\.julia\packages\PyCall\ttONZ\deps\build.log`

(v1.3) pkg> build PyPlot
  Building Conda ─→ `C:\Users\AAA\.julia\packages\Conda\kLXeC\deps\build.log`
  Building PyCall → `C:\Users\AAA\.julia\packages\PyCall\ttONZ\deps\build.log`

test出错

(v1.3) pkg> test PyPlot
   Testing PyPlot
    Status `C:\Users\AA~1\AppData\Local\Temp\jl_L6fj9b\Manifest.toml`
  [3da002f7] ColorTypes v0.8.1
  [5ae59095] Colors v0.9.6
  [34da2185] Compat v2.2.0
  [8f4d0f93] Conda v1.3.0
  [864edb3b] DataStructures v0.17.6
  [53c48c17] FixedPointNumbers v0.6.1
  [682c06a0] JSON v0.21.0
  [b964fa9f] LaTeXStrings v1.0.3
  [1914dd2f] MacroTools v0.5.3
  [bac558e1] OrderedCollections v1.1.0
  [69de0a69] Parsers v0.3.10
  [438e738f] PyCall v1.91.2
  [d330b81b] PyPlot v2.8.2
  [189a3867] Reexport v0.2.0
  [81def892] VersionParsing v1.2.0
  [2a0f44e3] Base64  [`@stdlib/Base64`]
  [ade2ca70] Dates  [`@stdlib/Dates`]
  [8bb1440f] DelimitedFiles  [`@stdlib/DelimitedFiles`]
  [8ba89e20] Distributed  [`@stdlib/Distributed`]
  [b77e0a4c] InteractiveUtils  [`@stdlib/InteractiveUtils`]
  [76f85450] LibGit2  [`@stdlib/LibGit2`]
  [8f399da3] Libdl  [`@stdlib/Libdl`]
  [37e2e46d] LinearAlgebra  [`@stdlib/LinearAlgebra`]
  [56ddb016] Logging  [`@stdlib/Logging`]
  [d6f4376e] Markdown  [`@stdlib/Markdown`]
  [a63ad114] Mmap  [`@stdlib/Mmap`]
  [44cfe95a] Pkg  [`@stdlib/Pkg`]
  [de0858da] Printf  [`@stdlib/Printf`]
  [3fa0cd96] REPL  [`@stdlib/REPL`]
  [9a3f8284] Random  [`@stdlib/Random`]
  [ea8e919c] SHA  [`@stdlib/SHA`]
  [9e88b42a] Serialization  [`@stdlib/Serialization`]
  [1a1011a3] SharedArrays  [`@stdlib/SharedArrays`]
  [6462fe0b] Sockets  [`@stdlib/Sockets`]
  [2f01184e] SparseArrays  [`@stdlib/SparseArrays`]
  [10745b16] Statistics  [`@stdlib/Statistics`]
  [8dfed614] Test  [`@stdlib/Test`]
  [cf7118a7] UUIDs  [`@stdlib/UUIDs`]
  [4ec0a83e] Unicode  [`@stdlib/Unicode`]
[ Info: PyPlot is using Matplotlib 3.1.1 with Python 3.6.5
Test Failed at C:\Users\AAA\.julia\packages\PyPlot\4wzW1\test\runtests.jl:25
  Expression: m !== nothing
   Evaluated: nothing !== nothing
ERROR: LoadError: There was an error during testing
in expression starting at C:\Users\AAA\.julia\packages\PyPlot\4wzW1\test\runtests.jl:22
ERROR: Package PyPlot errored during testing

尝试画图,没有图像出现

x = range(0; stop=2*pi, length=1000); 
y = sin.(3 * x + 4 * cos.(2 * x));
PyPlot.plot(x, y, color="red", linewidth=2.0, linestyle="--")
1-element Array{PyCall.PyObject,1}:
 PyObject <matplotlib.lines.Line2D object at 0x00000000667C5390>

当前包状态

julia> Pkg.status()
    Status `C:\Users\AAA\.julia\environments\v1.3\Project.toml`
  [537997a7] AbstractPlotting v0.9.15 #master (https://github.com/JuliaPlots/AbstractPlotting.jl.git)
  [c52e3926] Atom v0.11.3
  [6e4b80f9] BenchmarkTools v0.4.3
  [31a5f54b] Debugger v0.6.2
  [e9467ef8] GLMakie v0.0.11 #master (https://github.com/JuliaPlots/GLMakie.jl.git)
  [28b8d3ca] GR v0.44.0
  [4d00f742] GeometryTypes v0.7.6
  [6a3955dd] ImageFiltering v0.6.7
  [aa1ae85d] JuliaInterpreter v0.7.5
  [e5e0dc1b] Juno v0.7.2

删除PyPlot再安装仍然出现这个错误,有什么办法解决呢?

我看了你的也test了一下,居然也出错了。。不过我确实之前一直能用,可能是我一直用savefig也能存图的。他们说可以用指令:
using PyCall
pygui(:true)
然后再画图就可以了,好像是后端的问题吧,不是很懂,然后每次都得这样来一次才能显示图片,不过不影响存图片就是了。