对于Enthought的Canopy和Julia有一些奇怪的实现PyCall
(我想这与Canopy没有更新distutils.sysconfig
??)。
此问题some discussion通过将PyCall
指向正确的共享库来解决问题。
如何使此永久(如何更改distutils.sysconfig
)?
一些输出:
julia> using PyPlot
ERROR: could not load module python: dlopen(python.dylib, 9): image not found
in pyinitialize at /Users/bdhammel/.julia/PyCall/src/PyCall.jl:422
in pyimport at /Users/bdhammel/.julia/PyCall/src/PyCall.jl:105
in include at boot.jl:238
in include_from_node1 at loading.jl:114
in reload_path at loading.jl:140
in _require at loading.jl:58
in require at loading.jl:43
at /Users/bdhammel/.julia/PyPlot/src/PyPlot.jl:32
julia> using PyCall
julia> pyinitialize("/Users/bdhammel/Library/Enthought/Canopy_64bit/System/lib/libpython2.7.dylib")
/Users/bdhammel/Library/Enthought/Canopy_64bit/System/lib/libpython2.7.dylib: /Users/bdhammel/Library/Enthought/Canopy_64bit/System/lib/libpython2.7.dylib: cannot execute binary file
julia> using PyPlot
Warning: Possible conflict in library symbol dtrtri_
Warning: Possible conflict in library symbol dgetri_
Warning: Possible conflict in library symbol dgetrf_
julia> plot([1,2])
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x115b95090>
并绘制线条
我想将其设置为工作,而不必执行pyinitialize
位。
来自链接讨论:
PyCall运行python可执行文件并执行:
import distutils.sysconfig
print(distutils.sysconfig.get_config_var('LDLIBRARY'))
print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX'))
这些路径存储在哪里,我应该更改哪些内容?
在python中输出这些命令:
In [1]: import distutils
In [2]: print(distutils.sysconfig.get_config_var('LDLIBRARY'))
Python.framework/Versions/2.0.0.dev-f1c6cfc/Python
In [3]: print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX'))
/Library/Frameworks
In [4]: distutils.__file__
Out[4]: '/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/__init__.pyc'
最后:我是否需要担心cannot execute binary file
或Possible conflict ...
部分?
答案 0 :(得分:1)
请参阅PyCall issue #42,这是讨论的正确位置。问题有所改善,但是在带有Canopy / EPD的Windows上仍然存在一些运行时路径问题,现在我建议使用Anaconda Python。