PyCall, PyPlot怎么都安装不成功啊。
是因为被墙了吗
PyCall, PyPlot怎么都安装不成功啊。
是因为被墙了吗
如果是网络问题这个就能解决。
下次最好把报错贴上来。
download ca cert error on Linux on Julia 1.10.1 · Issue #53339 · JuliaLang/julia (github.com) 如果linux下最新版也可能是这个bug
export JULIA_SSL_CA_ROOTS_PATH=/etc/ssl/certs/ca-bundle.crt
(@v1.10) pkg> add PyCall
Resolving package versions...
No Changes to `C:\Users\jmzhang\.julia\environments\v1.10\Project.toml`
No Changes to `C:\Users\jmzhang\.julia\environments\v1.10\Manifest.toml`
Precompiling project...
2 dependencies successfully precompiled in 23 seconds. 346 already precompiled.
julia> using PyCall
julia>
很奇怪。这个是安装成功了吗?
我是windows 10, vs code。
怎么我的julia下面的文件夹跟你的链接里的完全不一样啊?
(@v1.10) pkg> add PyPlot
Resolving package versions...
No Changes to `C:\Users\jmzhang\.julia\environments\v1.10\Project.toml`
No Changes to `C:\Users\jmzhang\.julia\environments\v1.10\Manifest.toml`
julia> using PyPlot
[ Info: Installing matplotlib via the Conda matplotlib package...
[ Info: Running `conda install -y matplotlib` in root environment
Channels:
- defaults
- conda-forge
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 23.11.0
latest version: 24.1.2
Please update conda by running
$ conda update -n base -c conda-forge conda
# All requested packages already installed.
ERROR: InitError: PyError (PyImport_ImportModule
The Python package matplotlib could not be imported by pyimport. Usually this means
that you did not install matplotlib 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 module, you can
use `pyimport_conda("matplotlib", PKG)`, where PKG is the Anaconda
package that contains the module matplotlib, 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 'ImportError'>
ImportError('DLL load failed while importing _imaging: 找不到指定的模块。')
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\matplotlib\__init__.py", line 161, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\matplotlib\colors.py", line 52, in <module>
from PIL import Image
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\PIL\Image.py", line 84, in <module>
from . import _imaging as core
Stacktrace:
[1] pyimport(name::String)
@ PyCall C:\Users\jmzhang\.julia\packages\PyCall\1gn3u\src\PyCall.jl:558
[2] pyimport_conda
@ C:\Users\jmzhang\.julia\packages\PyCall\1gn3u\src\PyCall.jl:722
[3] pyimport_conda
@ PyCall C:\Users\jmzhang\.julia\packages\PyCall\1gn3u\src\PyCall.jl:715 [inlined]
[4] __init__()
@ PyPlot C:\Users\jmzhang\.julia\packages\PyPlot\2MlrT\src\init.jl:174
[5] run_module_init(mod::Module, i::Int64)
@ Base .\loading.jl:1128
[6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
@ Base .\loading.jl:1116
[7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
@ Base .\loading.jl:1061
[8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
@ Base .\loading.jl:1575
[9] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1932
[10] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1806
[11] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[12] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[13] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1797
[14] macro expansion
@ Base .\loading.jl:1784 [inlined]
[15] macro expansion
@ Base .\lock.jl:267 [inlined]
[16] __require(into::Module, mod::Symbol)
@ Base .\loading.jl:1747
[17] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[18] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[19] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1740
during initialization of module PyPlot
caused by: PyError (PyImport_ImportModule
The Python package matplotlib could not be imported by pyimport. Usually this means
that you did not install matplotlib 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 module, you can
use `pyimport_conda("matplotlib", PKG)`, where PKG is the Anaconda
package that contains the module matplotlib, 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 'ImportError'>
ImportError('DLL load failed while importing _imaging: 找不到指定的模块。')
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\matplotlib\__init__.py", line 161, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\matplotlib\colors.py", line 52, in <module>
from PIL import Image
File "C:\Users\jmzhang\.julia\conda\3\x86_64\lib\site-packages\PIL\Image.py", line 84, in <module>
from . import _imaging as core
Stacktrace:
[1] pyimport(name::String)
@ PyCall C:\Users\jmzhang\.julia\packages\PyCall\1gn3u\src\PyCall.jl:558
[2] pyimport_conda
@ C:\Users\jmzhang\.julia\packages\PyCall\1gn3u\src\PyCall.jl:716
[3] pyimport_conda
@ PyCall C:\Users\jmzhang\.julia\packages\PyCall\1gn3u\src\PyCall.jl:715 [inlined]
[4] __init__()
@ PyPlot C:\Users\jmzhang\.julia\packages\PyPlot\2MlrT\src\init.jl:174
[5] run_module_init(mod::Module, i::Int64)
@ Base .\loading.jl:1128
[6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
@ Base .\loading.jl:1116
[7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
@ Base .\loading.jl:1061
[8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
@ Base .\loading.jl:1575
[9] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1932
[10] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1806
[11] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[12] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[13] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1797
[14] macro expansion
@ Base .\loading.jl:1784 [inlined]
[15] macro expansion
@ Base .\lock.jl:267 [inlined]
[16] __require(into::Module, mod::Symbol)
@ Base .\loading.jl:1747
[17] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[18] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[19] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1740
julia>
更推荐试试
JuliaPy/PythonCall.jl: Python and Julia in harmony. (github.com)
JuliaPlots/Plots.jl: Powerful convenience for Julia visualizations and data analysis (github.com)
JuliaComputing/PlotlyLight.jl: Plotly.js via Julia made easy. (github.com)
makie.org
还有python的镜像配置 Oh My TUNA
你这个应该属于配置路径不是安装路径。
我俩文件夹都有。
你直接右键桌面Julia图标查看属性
如果你有添加到环境变量——就是cmd里面输入julia回车就能调出——的话,去环境变量
里面去找带Julia的路径也可以。
环境变量里是
C:\Users\jmzhang\AppData\Local\Programs\Julia-1.10.0\bin\julia.exe