使用PyPlot崩溃朱莉娅

时间:2017-10-24 13:13:34

标签: python matplotlib julia jupyter-notebook

我刚刚通过Anaconda重新安装了Julia 0.5.2Python 3.6.3 :: Anaconda, Inc.。当jupyter笔记本中的using PyPlot(带有julia内核)时,我得到以下内容:

InitError: PyError (:PyImport_ImportModule

The Python package matplotlib.pyplot could not be found by pyimport. Usually this means
that you did not install matplotlib.pyplot in the Python version being used by PyCall.

PyCall is currently configured to use the Python version at:

/home/riccardo/anaconda3/bin/python

and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the matplotlib.pyplot module.

One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV["PYTHON"] to the path/name of the python
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.

Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia.  As explained in the PyCall documentation,
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
To install the matplotlib.pyplot module, you can use `pyimport_conda("matplotlib.pyplot", PKG)`,
where PKG is the Anaconda package the contains the module matplotlib.pyplot,
or alternatively you can use the Conda package directly (via
`using Conda` followed by `Conda.add` etcetera).

) <class 'ImportError'>
ImportError("/lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /home/riccardo/anaconda3/lib/python3.6/site-packages/matplotlib/../../.././libpng16.so.16)",)
  File "/home/riccardo/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "/home/riccardo/anaconda3/lib/python3.6/site-packages/matplotlib/colorbar.py", line 36, in <module>
    import matplotlib.contour as contour
  File "/home/riccardo/anaconda3/lib/python3.6/site-packages/matplotlib/contour.py", line 21, in <module>
    import matplotlib.font_manager as font_manager
  File "/home/riccardo/anaconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 58, in <module>
    from matplotlib import afm, cbook, ft2font, rcParams, get_cachedir

during initialization of module PyPlot

 in pyerr_check at /home/riccardo/.julia/v0.5/PyCall/src/exception.jl:56 [inlined]
 in pyerr_check at /home/riccardo/.julia/v0.5/PyCall/src/exception.jl:61 [inlined]
 in macro expansion at /home/riccardo/.julia/v0.5/PyCall/src/exception.jl:81 [inlined]
 in pyimport(::String) at /home/riccardo/.julia/v0.5/PyCall/src/PyCall.jl:374
 in __init__() at /home/riccardo/.julia/v0.5/PyPlot/src/init.jl:184
 in _include_from_serialized(::String) at ./loading.jl:150
 in _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:187
 in _require_search_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:217
 in require(::Symbol) at ./loading.jl:371
 in include_string(::String, ::String) at ./loading.jl:441

但是,我使用anaconda-navigator检查并且matplotlib存在(在带有python内核的{jupyter笔记本中from matplotlib import pyplot正常工作)。

您对如何解决这些问题有什么建议吗?我看到其他人已经指出这一点,但在这些情况下,它似乎与多种环境的使用有关。虽然在我的情况下我只有一个。

0 个答案:

没有答案