【发布时间】:2019-07-18 22:25:07
【问题描述】:
在构建和预编译 PyCall 之后,我尝试了一些 example code 来验证它的功能。不幸的是,我马上就遇到了错误。
julia> import Pkg
julia> Pkg.build("PyCall")
Building Conda ─→ `C:\Users\Student\.julia\packages\Conda\kLXeC\deps\build.log`
Building PyCall → `C:\Users\Student\.julia\packages\PyCall\ttONZ\deps\build.log`
julia> import PyCall
julia> math = pyimport("math")
ERROR: UndefVarError: pyimport not defined
Stacktrace:
[1] top-level scope at none:0
julia> py"""
import math
math.sin(math.pi / 4)
"""
ERROR: LoadError: UndefVarError: @py_str not defined
in expression starting at REPL[5]:1
julia> py"import math"
ERROR: LoadError: UndefVarError: @py_str not defined
in expression starting at REPL[6]:1
我在 Windows 10 x64 上使用 Julia 1.1.1 (2019-05-16)。我在网上没有看到任何关于这个特定问题的信息,现在对此感到沮丧。
【问题讨论】:
-
你试过
using PyCall而不是import PyCall吗?