您好我尝试使用命令Pkg.build("PyCall")
using PyCall
@pyimport matplotlib.pyplot as plt
在Julia中使用matplotlib,但我不断收到以下错误消息:
PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)) <type 'exceptions.RuntimeError'>
RuntimeError("Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.",)
File "/Users/mymac/Library/Python/2.7/lib/python/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Users/mymac/Library/Python/2.7/lib/python/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/Users/mymac/Library/Python/2.7/lib/python/site-packages/matplotlib/backends/backend_macosx.py", line 19, in <module>
from matplotlib.backends import _macosx
以下是我已尝试过的以下步骤
在Julia内核尝试运行@pyimport math
==&gt;这工作
在Python内核中,我尝试运行import matplotlib as plt
==&gt;它的工作原理
我在MacOS 10.13.2上卸载所有python版本并重新安装Python版本3.6.5。我仍然得到相同的错误消息。
在终端我尝试运行:$ curl -O https://bootstrap.pypa.io/get-pip.py
然后python3 get-pip.py
但仍在Julia中收到错误消息
从/Users/mymac/Library/
删除Python后,似乎Julia重新创建路径/Users/mymac/Library/Python/2.7/
非常感谢您提前
答案 0 :(得分:1)
您是否尝试在Julia中安装PyPlot.jl包?
Pkg.install("PyPlot")