我最近开始尝试从ipython笔记本切换到canopy,这是我从MATLAB切换到的。我正在努力获得类似matlab的开发和研究经验。在
我正在跨平台进行这些设置,但我是从OSX开始的
我一直在尝试安装在canopy中使用的包,其中一些包需要编译,比如SimpleITK和VTK6.0。我把这两个都成功地安装在python2.7的常规安装中,但是在为canopy安装它们时遇到了一些麻烦。现在,我正在用CMAKE重新编译SimpleITK/Superbuild来重新创建python包装器。它要求您的python可执行文件include dir和python lib位置。我发现python可以从系统可执行文件在canopy中,以及带有'mdfind-namepython.h的include dir,这是默认位置,我使用了默认的Python库。在
这些是 在
executeable: /Users/jmerkow/Library/Enthought/Canopy_64bit/User/bin/python
Include: /System/Library/Frameworks/Python.framework/Headers
Lib: /usr/lib/libpython2.7.dylib
但我在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
另外,任何其他帮助我完成这项工作的建议都是非常受欢迎的
在下面编辑
因此,我尝试使用以下方法进行编译:
/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
这个编译和创建的egg文件名为
SimpleITK-0.7.0.dev88_ge297c-py2.7-macosx-10.8-intel.egg
但是我在使用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'
使用easy_install时,我收到以下错误:
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')
它看起来像是我安装的,所以我尝试导入:
import SimpleITK
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
您已经将SimpleITK配置为使用系统python可执行文件、库和include文件。但是,您正在尝试运行树冠分布。它们不是二进制兼容的,不匹配导致了这种类型的程序终止。在
您的canopy python可执行文件已正确找到: /Users/jmerkow/Library/enhough/cabing_64bit/User/bin/python
但是您需要使PYTHON_INCLUDE_DIR和PYTHON_库保持一致。请尝试以下命令以帮助您确定正确的路径:
查找/Users/jmerkow/Library/enhough/cabing_64bit/-name Python.h 查找/Users/jmerkow/Library/enhough/cabing_64bit/-name lib python*.dylib
相关问题 更多 >
编程相关推荐