julia - 无法在 FreeBSD 13 上使用 Julia 1.6.3 安装 PyCall.jl
问题描述
我正在尝试安装 PyCall.jl,但出现错误。我已经在 FreeBSD 13 中安装了(bulit)Python 3.10。我还在操作系统上单独创建了一个 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 安装)
推荐阅读
- django - Django Rest 更改 URL 中的主键以使用自定义键
- vba - Excel VBA - 填充 Avery 模板
- google-chrome - 如何减少 Chrome v68 书签栏中的填充?
- python - 直接从给定的纸牌中检测并返回
- php - 执行 CURL Post 请求时 CakePHP 中的 CSRF 令牌
- java - Java HtmlUnit Ajax 调用永远不会在 HtmlPage 中呈现
- angular - Angular 4 - 无法通过服务在组件之间共享数据
- ansible - 如何通过从 group_vars/all 获得的另一个任务项从 shell 输出迭代先前的任务结果
- swift - NSInternalInconsistencyException 完成处理程序传递给 webView:decidePolicyForNavigationAction:decisionHandle 未被调用
- python - 如何构建内存中的虚拟文件系统,然后将此结构写入磁盘