首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Julia中使用PyPlot会出现错误: PyCall未正确安装

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

Stack Overflow用户
提问于 2020-12-09 04:05:28
回答 1查看 480关注 0票数 1

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

代码语言:javascript
复制
using PyPlot

但它总是返回以下错误:

代码语言:javascript
复制
[ 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

当我使用Pkg.build("PyCall")时,我得到以下错误:

代码语言:javascript
复制
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造成的。

有人知道该怎么做吗?

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2020-12-09 22:06:28

这个问题实际上发生在PyCall用来安装Python发行版的Conda.jl中。特别是,download命令无法获取miniconda安装程序。您可以尝试运行

代码语言:javascript
复制
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)和configure PyCall to use that,而不是安装自己的Python发行版。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65206122

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档