0

I recently started trying to switch to canopy from ipython notebooks, which I switched to from MATLAB. I am working towards getting a matlab-like experience for development and research.

I am doing most of these setups cross-platform, but I am starting on OS X.

I have been attempting to install packages for use in canopy, some of which require compilation such as SimpleITK and VTK6.0. I had these both successfully installed in my regular python2.7 installation, but I'm having some trouble installing them for canopy. Right now, Im working on recompiling SimpleITK/Superbuild with CMAKE to recreate the python wrappers. It asks for your python executable, include dir, and python lib location. I found the python executeable from sys.executable from within canopy, and the include dir with 'mdfind -name Python.h, which turned out to be the default location, I used the default python lib.

These were

executeable: /Users/jmerkow/Library/Enthought/Canopy_64bit/User/bin/python

Include: /System/Library/Frameworks/Python.framework/Headers

Lib: /usr/lib/libpython2.7.dylib

But I get the following error upon make:

AssertionError: Filename /Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/os.py does not start with any of these prefixes: ['/Users/jmerkow/Library/Enthought/Canopy_64bit/User', '/Library/Python/2.7/site-packages', '/Users/jmerkow/Library/Enthought/Canopy_64bit/User/Extras/lib/python', '/Users/jmerkow/Library/Python/2.7/site-packages', '/Users/jmerkow/.local/lib/python/2.7/site-packages', '/Users/jmerkow/Library/Python/2.7/lib/python/site-packages']
ERROR
-- Installing numpy from  /Users/jmerkow/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy to /numpy
ERROR
/bin/sh: ../Testing/Installation/PythonVirtualenv/bin/python: No such file or directory
make[5]: *** [lib/_SimpleITK.so] Error 127
make[4]: *** [Wrapping/CMakeFiles/SimpleITK_PYTHON.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
make[1]: *** [CMakeFiles/SimpleITK.dir/all] Error 2
make: *** [all] Error 2

Also, anyother tips to help me get this done are very welcome

EDIT BELOW

So I attempted to compile using:

/System/Library/Frameworks/Python.framework/Versions/Current/bin/python /System/Library/Frameworks/Python.framework/Versions/Current/include/python2.7/ /System/Library/Frameworks/Python.framework/Versions/Current/lib/libpython2.7.dylib

This compiled and created and egg file named

SimpleITK-0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg

but I get the following error when I use enpkg

Traceback (most recent call last): File "/Users/jmerkow/Library/Enthought/Canopy_64bit/User/bin/enpkg", line 10, in sys.exit(main()) File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/enstaller/main.py", line 702, in main reqs.append(Req(name + ' ' + version)) File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/enstaller/resolve.py", line 32, in init raise Exception("Not a valid requirement: %r" % req_string) Exception: Not a valid requirement: 'SimpleITK 0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg'

with easy_install I get this error:

Processing SimpleITK-0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg removing '/Users/jmerkow/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/SimpleITK-0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg' (and everything under it) creating /Users/jmerkow/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/SimpleITK-0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg Extracting SimpleITK-0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg to /Users/jmerkow/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages SimpleITK 0.7.0.dev88-ge297c is already the active version in easy-install.pth

Installed /Users/jmerkow/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/SimpleITK-0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg Processing dependencies for SimpleITK==0.7.0.dev88-ge297c Searching for SimpleITK==0.7.0.dev88-ge297c Reading cant post Reading cant post Reading cant post No local packages or download links found for SimpleITK==0.7.0.dev88-ge297c error: Could not find suitable distribution for Requirement.parse('SimpleITK==0.7.0.dev88-ge297c')

It looked like I installed it, so I tried to import:

import SimpleITK

Fatal Python error: PyThreadState_Get: no current thread

Abort trap: 6

4

1 回答 1

0

您已将 SimpleITK 配置为使用您的系统 python 可执行文件、库和包含文件。但是,您正在尝试使用 Canopy 发行版运行。它们不是二进制兼容的,并且不匹配导致该类型的程序终止。

您正确找到了 Canopy python 可执行文件:/Users/jmerkow/Library/Enthought/Canopy_64bit/User/bin/python

但是您需要使 PYTHON_INCLUDE_DIR 和 PYTHON_LIBRARY 保持一致。尝试以下命令来帮助您确定正确的路径:

查找 /Users/jmerkow/Library/Enthought/Canopy_64bit/ -name Python.h 查找 /Users/jmerkow/Library/Enthought/Canopy_64bit/ -name lib python*.dylib

于 2013-11-07T15:32:39.897 回答