我想在我的 Julia 代码中使用一系列 Python 库。我一直在尝试使用 PyCall 访问我已经安装在我的(Windows)PC 上的 Python 库;但是,我无法重新配置 PyCall,使其远离 Julia 私有的默认 Python 发行版。按照文档中的步骤(https://github.com/JuliaPy/PyCall.jl),我在 Julia 中尝试了以下操作:
using Pkg
ENV["PYTHON"] = raw"C:\Users\catod\AppData\Local\Programs\Python\Python37-32\python.exe"
Pkg.build(PyCall)
退出并重新进入 Julia 后,我尝试运行
using PyCall
plt = pyimport("matplotlib.pyplot")
但收到以下错误消息:
ERROR: LoadError: PyError (PyImport_ImportModule
The Python package matplotlib.pyplot could not be imported 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 Julia-specific Python distribution
installed by the Conda.jl package. 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).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'matplotlib'")
谁能指出我哪里出错了?