Python 在Julia中使用PyPlot会出现错误:PyCall未正确安装

Python 在Julia中使用PyPlot会出现错误:PyCall未正确安装,python,matplotlib,error-handling,package,julia,Python,Matplotlib,Error Handling,Package,Julia,我是朱莉娅的新手。我正在尝试使用导入“PyPlot” 但它总是返回以下错误: [ Info: Precompiling PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee] ERROR: LoadError: LoadError: PyCall not properly installed. Please run Pkg.build ("PyCall") Stacktrace: [1] error(::String) at .\erro

我是朱莉娅的新手。我正在尝试使用导入“PyPlot”

但它总是返回以下错误:

[ Info: Precompiling PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]
ERROR: LoadError: LoadError: PyCall not properly installed. Please run Pkg.build
("PyCall")
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] top-level scope at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\startup
.jl:44
 [3] include(::Function, ::Module, ::String) at .\Base.jl:380
 [4] include at .\Base.jl:368 [inlined]
 [5] include(::String) at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\PyCal
l.jl:1
 [6] top-level scope at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\PyCall.
jl:38
 [7] include(::Function, ::Module, ::String) at .\Base.jl:380
 [8] include(::Module, ::String) at .\Base.jl:368
 [9] top-level scope at none:2
 [10] eval at .\boot.jl:331 [inlined]
 [11] eval(::Expr) at .\client.jl:467
 [12] top-level scope at .\none:3
in expression starting at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\start
up.jl:41
in expression starting at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\PyCal
l.jl:38
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45
ab0] to C:\Users\Carlos\.julia\compiled\v1.5\PyCall\GkzkC_NvSXt.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
 [3] _require(::Base.PkgId) at .\loading.jl:1030
 [4] require(::Base.PkgId) at .\loading.jl:928
 [5] require(::Module, ::Symbol) at .\loading.jl:923
 [6] include(::Function, ::Module, ::String) at .\Base.jl:380
 [7] include(::Module, ::String) at .\Base.jl:368
 [8] top-level scope at none:2
 [9] eval at .\boot.jl:331 [inlined]
 [10] eval(::Expr) at .\client.jl:467
 [11] top-level scope at .\none:3
in expression starting at C:\Users\Carlos\.julia\packages\PyPlot\XHEG0\src\PyPlo
t.jl:4
ERROR: Failed to precompile PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee] to C:\
Users\Carlos\.julia\compiled\v1.5\PyPlot\oatAj_NvSXt.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
 [3] _require(::Base.PkgId) at .\loading.jl:1030
 [4] require(::Base.PkgId) at .\loading.jl:928
 [5] require(::Module, ::Symbol) at .\loading.jl:923
julia> Pkg.build("PyCall")
   Building Conda ─→ `C:\Users\Carlos\.julia\packages\Conda\x5ml4\deps\build.log
`
   Building PyCall → `C:\Users\Carlos\.julia\packages\PyCall\BcTLp\deps\build.lo
g`
┌ Error: Error building `PyCall`:
│ ┌ Info: Using the Python distribution in the Conda package by default.
│ └ To use a different Python version, set ENV["PYTHON"]="pythoncommand" and re-
run Pkg.build("PyCall").
│ [ Info: Downloading miniconda installer ...
│ ERROR: LoadError: failed process: Process(`'C:\Windows\System32\WindowsPowerSh
ell\v1.0\powershell.exe' -Version 3 -NoProfile -Command "[System.Net.ServicePoin
tManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Obj
ect System.Net.Webclient).DownloadFile('https://repo.continuum.io/miniconda/Mini
conda3-latest-Windows-x86_64.exe', 'C:\Users\Carlos\.julia\conda\3\installer.exe
')"`, ProcessExited(3221225477)) [3221225477]
│
│ Stacktrace:
│  [1] pipeline_error at .\process.jl:525 [inlined]
│  [2] download_powershell(::String, ::String) at .\download.jl:20
│  [3] download at .\download.jl:64 [inlined]
│  [4] _install_conda(::String, ::Bool) at C:\Users\Carlos\.julia\packages\Conda
\x5ml4\src\Conda.jl:166
│  [5] _install_conda(::String) at C:\Users\Carlos\.julia\packages\Conda\x5ml4\s
rc\Conda.jl:157
│  [6] runconda(::Cmd, ::String) at C:\Users\Carlos\.julia\packages\Conda\x5ml4\
src\Conda.jl:114
│  [7] add(::String, ::String; channel::String) at C:\Users\Carlos\.julia\packag
es\Conda\x5ml4\src\Conda.jl:190
│  [8] add at C:\Users\Carlos\.julia\packages\Conda\x5ml4\src\Conda.jl:189 [inli
ned] (repeats 2 times)
│  [9] top-level scope at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\deps\buil
d.jl:84
│  [10] include(::String) at .\client.jl:457
│  [11] top-level scope at none:5
│ in expression starting at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\deps\bu
ild.jl:43
└ @ Pkg.Operations D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib
\v1.5\Pkg\src\Operations.jl:942
使用
Pkg.build(“PyCall”)
时,出现以下错误:

[ Info: Precompiling PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]
ERROR: LoadError: LoadError: PyCall not properly installed. Please run Pkg.build
("PyCall")
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] top-level scope at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\startup
.jl:44
 [3] include(::Function, ::Module, ::String) at .\Base.jl:380
 [4] include at .\Base.jl:368 [inlined]
 [5] include(::String) at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\PyCal
l.jl:1
 [6] top-level scope at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\PyCall.
jl:38
 [7] include(::Function, ::Module, ::String) at .\Base.jl:380
 [8] include(::Module, ::String) at .\Base.jl:368
 [9] top-level scope at none:2
 [10] eval at .\boot.jl:331 [inlined]
 [11] eval(::Expr) at .\client.jl:467
 [12] top-level scope at .\none:3
in expression starting at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\start
up.jl:41
in expression starting at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\src\PyCal
l.jl:38
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45
ab0] to C:\Users\Carlos\.julia\compiled\v1.5\PyCall\GkzkC_NvSXt.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
 [3] _require(::Base.PkgId) at .\loading.jl:1030
 [4] require(::Base.PkgId) at .\loading.jl:928
 [5] require(::Module, ::Symbol) at .\loading.jl:923
 [6] include(::Function, ::Module, ::String) at .\Base.jl:380
 [7] include(::Module, ::String) at .\Base.jl:368
 [8] top-level scope at none:2
 [9] eval at .\boot.jl:331 [inlined]
 [10] eval(::Expr) at .\client.jl:467
 [11] top-level scope at .\none:3
in expression starting at C:\Users\Carlos\.julia\packages\PyPlot\XHEG0\src\PyPlo
t.jl:4
ERROR: Failed to precompile PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee] to C:\
Users\Carlos\.julia\compiled\v1.5\PyPlot\oatAj_NvSXt.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
 [3] _require(::Base.PkgId) at .\loading.jl:1030
 [4] require(::Base.PkgId) at .\loading.jl:928
 [5] require(::Module, ::Symbol) at .\loading.jl:923
julia> Pkg.build("PyCall")
   Building Conda ─→ `C:\Users\Carlos\.julia\packages\Conda\x5ml4\deps\build.log
`
   Building PyCall → `C:\Users\Carlos\.julia\packages\PyCall\BcTLp\deps\build.lo
g`
┌ Error: Error building `PyCall`:
│ ┌ Info: Using the Python distribution in the Conda package by default.
│ └ To use a different Python version, set ENV["PYTHON"]="pythoncommand" and re-
run Pkg.build("PyCall").
│ [ Info: Downloading miniconda installer ...
│ ERROR: LoadError: failed process: Process(`'C:\Windows\System32\WindowsPowerSh
ell\v1.0\powershell.exe' -Version 3 -NoProfile -Command "[System.Net.ServicePoin
tManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Obj
ect System.Net.Webclient).DownloadFile('https://repo.continuum.io/miniconda/Mini
conda3-latest-Windows-x86_64.exe', 'C:\Users\Carlos\.julia\conda\3\installer.exe
')"`, ProcessExited(3221225477)) [3221225477]
│
│ Stacktrace:
│  [1] pipeline_error at .\process.jl:525 [inlined]
│  [2] download_powershell(::String, ::String) at .\download.jl:20
│  [3] download at .\download.jl:64 [inlined]
│  [4] _install_conda(::String, ::Bool) at C:\Users\Carlos\.julia\packages\Conda
\x5ml4\src\Conda.jl:166
│  [5] _install_conda(::String) at C:\Users\Carlos\.julia\packages\Conda\x5ml4\s
rc\Conda.jl:157
│  [6] runconda(::Cmd, ::String) at C:\Users\Carlos\.julia\packages\Conda\x5ml4\
src\Conda.jl:114
│  [7] add(::String, ::String; channel::String) at C:\Users\Carlos\.julia\packag
es\Conda\x5ml4\src\Conda.jl:190
│  [8] add at C:\Users\Carlos\.julia\packages\Conda\x5ml4\src\Conda.jl:189 [inli
ned] (repeats 2 times)
│  [9] top-level scope at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\deps\buil
d.jl:84
│  [10] include(::String) at .\client.jl:457
│  [11] top-level scope at none:5
│ in expression starting at C:\Users\Carlos\.julia\packages\PyCall\BcTLp\deps\bu
ild.jl:43
└ @ Pkg.Operations D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib
\v1.5\Pkg\src\Operations.jl:942
我在不同的论坛上找到了几种不同的解决方案,包括StackOverflow,但这些解决方案在我的具体案例中似乎不起作用。这似乎与防病毒/防火墙问题无关

另外,问题特别是PyCall而不是PyPlot

有人知道在这里做什么吗


谢谢。

问题实际上发生在中,PyCall使用它安装Python发行版。特别是,下载命令无法获取miniconda安装程序。你可以试试跑步

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 3 -NoProfile -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe', 'C:\Users\Carlos\.julia\conda\3\installer.exe')"
在终端中手动查看是否可以重现问题。(如果下载失败,最常见的困难来源是防火墙。)


作为一种解决方法,您可以自己安装Python+Matplotlib(例如下载并安装Anaconda Python),而不是安装自己的Python发行版。

当您按照错误消息中的第一条建议运行
Pkg.build(“PyCall”)
时会发生什么?(这也需要
使用Pkg
)@Przemyslaw Szufel Done。我用Pkg.build(“PyCall”)的输出编辑了我的问题,这也给了我一个错误。错误322225477是一个访问冲突错误。因此,这意味着powershell.exe非常丑陋。很难说有什么帮助-可能是文件系统、驱动程序有问题,或者Windows更新有帮助。可能是因为您没有
C:\Users\Carlos\.julia\conda\3
的写入权限?这可能是个问题,因为julia 1.5.3在Windows上有权限错误(在某些情况下需要手动设置权限)。然而,据我所知,这个错误与RAM访问错误有关。