使用 Julia 构建时的 PyPlot 问题

PyPlot problems when building with Julia

我在 Julia 中构建 PyCall 时遇到问题(我使用的是 Mac)。我有消息:

朱莉娅> Pkg.build("PyCall") 建筑康达 ─→ ~/.julia/packages/Conda/3rPhK/deps/build.log

构建 PyCall → ~/.julia/packages/PyCall/BcTLp/deps/build.log

┌ Error: Error building `PyCall`: 
│   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
│                                  Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 55.2M  100 55.2M    0     0  8088k      0  0:00:06  0:00:06 --:--:--  9.8M
│ ERROR: did not recognize option '1/.julia/conda/3', please try -h
│ ┌ 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 ...
│ [ Info: Installing miniconda ...
│ ERROR: LoadError: failed process: Process(`'/Users/ymedinag 1/.julia/conda/3/installer.sh' -b -f -p '/Users/ymedinag 1/.julia/conda/3'`, ProcessExited(1)) [1]
│ Stacktrace:
│  [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
│  [2] pipeline_error at ./process.jl:705 [inlined]
│  [3] #run#505(::Bool, ::Function, ::Cmd) at ./process.jl:663
│  [4] run at ./process.jl:661 [inlined]
│  [5] _install_conda(::String, ::Bool) at /Users/ymedinag 1/.julia/packages/Conda/3rPhK/src/Conda.jl:169
│  [6] _install_conda(::String) at /Users/ymedinag 1/.julia/packages/Conda/3rPhK/src/Conda.jl:155
│  [7] runconda(::Cmd, ::String) at /Users/ymedinag 1/.julia/packages/Conda/3rPhK/src/Conda.jl:112
│  [8] #add#1(::String, ::Function, ::String, ::String) at /Users/ymedinag 1/.julia/packages/Conda/3rPhK/src/Conda.jl:188
│  [9] add at /Users/ymedinag 1/.julia/packages/Conda/3rPhK/src/Conda.jl:187 [inlined] (repeats 2 times)
│  [10] top-level scope at /Users/ymedinag 1/.julia/packages/PyCall/BcTLp/deps/build.jl:84
│  [11] include at ./boot.jl:317 [inlined]
│  [12] include_relative(::Module, ::String) at ./loading.jl:1044
│  [13] include(::Module, ::String) at ./sysimg.jl:29
│  [14] include(::String) at ./client.jl:392
│  [15] top-level scope at none:0
│ in expression starting at /Users/ymedinag 1/.julia/packages/PyCall/BcTLp/deps/build.jl:43
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1096

您知道如何正确安装 PyCall 吗?

谢谢

问题是因为您的用户名中有一个 space,或者更具体地说,您的用户目录 /Users/ymedinag 1/。不幸的是,这似乎是 Anaconda 安装程序的一个 known and unresolved 问题。在这里,PyCall 默认尝试通过 Conda.jl 使用 miniconda Python,后者又尝试通过 miniconda 的 installer.sh 脚本安装它。问题来自该脚本显然无法处理安装目录中的 spaces。

而不是使用默认的 Julia-managed conda-Python(安装失败),您可以自己将 miniconda 安装到没有 space 的目录,然后设置 ENV["PYTHON"] = <your-miniconda-python-path> 在 运行 之前再次 Pkg.build("PyCall")