Skip to content

Commit d086561

Browse files
committed
don't load libpython during PyCall build, as that may interfere with PyCall.__init__ later in the same process
1 parent 1d755f2 commit d086561

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

deps/build.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ function pythonenv(cmd::Cmd)
3636
setenv(cmd, env)
3737
end
3838

39-
pyconfigvar(python::AbstractString, var::AbstractString) = chomp(readstring(pythonenv(`$python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('$var'))"`)))
39+
pyvar(python::AbstractString, mod::AbstractString, var::AbstractString) = chomp(readstring(pythonenv(`$python -c "import $mod; print($mod.$var)"`)))
40+
41+
pyconfigvar(python::AbstractString, var::AbstractString) = pyvar(python, "distutils.sysconfig", "get_config_var('$var')")
4042
pyconfigvar(python, var, default) = let v = pyconfigvar(python, var)
4143
v == "None" ? default : v
4244
end
4345

44-
pysys(python::AbstractString, var::AbstractString) = chomp(readstring(pythonenv(`$python -c "import sys; print(sys.$var)"`)))
46+
pysys(python::AbstractString, var::AbstractString) = pyvar(python, "sys", var)
4547

4648
#########################################################################
4749

@@ -202,9 +204,7 @@ else
202204
end
203205

204206
# cache the Python version as a Julia VersionNumber
205-
const pyversion = withenv("PYTHONHOME"=>PYTHONHOME) do
206-
convert(VersionNumber, split(Py_GetVersion(libpython))[1])
207-
end
207+
const pyversion = VersionNumber(pyvar(python, "platform", "python_version()"))
208208

209209
info("PyCall is using $python (Python $pyversion) at $programname, libpython = $libpy_name")
210210

0 commit comments

Comments
 (0)