无法在 FreeBSD 13 上使用 Julia 1.6.3 安装 PyCall.jl

Cannot install PyCall.jl with Julia 1.6.3 build on FreeBSD 13

我正在尝试安装 PyCall.jl,但出现错误。我已经在 FreeBSD 13 中安装了 (bulit) Python 3.10。我还在 OS 上单独创建了一个 python 3.10 虚拟环境,我打算从中调用 python 包来自。错误如下。

(dataViz) pkg> add PyCall
   Resolving package versions...
   Installed VersionParsing ─ v1.2.1
   Installed Conda ────────── v1.5.2
   Installed MacroTools ───── v0.5.9
   Installed JSON ─────────── v0.21.2
   Installed PyCall ───────── v1.92.5
    Updating `/usr/home/schroter/dataViz/Project.toml`
  [438e738f] + PyCall v1.92.5
    Updating `/usr/home/schroter/dataViz/Manifest.toml`
  [8f4d0f93] + Conda v1.5.2
  [682c06a0] + JSON v0.21.2
  [1914dd2f] + MacroTools v0.5.9
  [438e738f] + PyCall v1.92.5
  [81def892] + VersionParsing v1.2.1
    Building Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/299304989a5e6473d985212c28928899c74e9421/build.log`
    Building PyCall → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/4ba3651d33ef76e24fef6a598b63ffd1c5e1cd17/build.log`
ERROR: Error building `PyCall`:
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
ERROR: LoadError: Couldn't find libpython; check your PYTHON environment variable.

The python executable we tried was python3 (= version 3.10).
Re-building with
    ENV["PYCALL_DEBUG_BUILD"] = "yes"
may provide extra information for why it failed.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] find_libpython(python::String; _dlopen::typeof(Base.Libc.Libdl.dlopen))
   @ Main ~/.julia/packages/PyCall/3fwVL/deps/buildutils.jl:72
 [3] find_libpython(python::String)
   @ Main ~/.julia/packages/PyCall/3fwVL/deps/buildutils.jl:41
 [4] top-level scope
   @ ~/.julia/packages/PyCall/3fwVL/deps/build.jl:82
 [5] include(fname::String)
   @ Base.MainInclude ./client.jl:444
 [6] top-level scope
   @ none:5
in expression starting at /home/schroter/.julia/packages/PyCall/3fwVL/deps/build.jl:43

Julia中安装的模块如下:

(dataViz) pkg> status
      Status `/usr/home/schroter/.jlmain/dataViz/Project.toml`
  [336ed68f] CSV v0.9.10
  [54eefc05] Cascadia v1.0.1
  [a93c6f00] DataFrames v1.2.2
  [708ec375] Gumbo v0.8.0
  [cd3eb016] HTTP v0.9.16
  [c3e4b0f8] Pluto v0.17.1
  [05625dda] WebDriver v0.1.2

编辑: 我的系统范围 python 位于:/usr/local/bin/python3 我的 python 虚拟环境位于:~/.pymain/dataViz/bin/activate.csh

有人能帮我解决这个问题吗?

谢谢并致以最诚挚的问候

施罗特

您没有提到设置 PYTHON 环境变量,所以这可能是问题的原因:

ENV["PYTHON"]="/usr/local/bin/python3"
using Pkg
Pkg.build("PyCall")

为了获得最佳效果,请尝试使用 Miniconda/Anaconda Python,最好让 Julia 安装它(我不知道在 FreeBSD 上安装 Miniconda 是多么容易或困难,在任何 Linux 它通常“正常工作”):

ENV["PYTHON"]=""
using Pkg
Pkg.build("PyCall")

如果您想使用一些 Miniconda:

ENV["PYTHON"]="/home/user/miniconda/bin/python"
using Pkg
Pkg.build("PyCall")

让我知道这是否有帮助(我没有要测试的 FreeBSD 安装)