我跟踪了SimpleElastix
在the link中的安装。当我运行以下命令安装SimpleLastix的python包装器时,它正在成功运行,可以导入包:
sudo python Packaging/setup.py install
我可以导入包并使用以下函数:
^{pr2}$但是,一旦我从python终端退出bash,并再次切换到python终端命令行,它将无法识别函数:
user@user-XPS-8920:~/workspace/registration$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import SimpleITK as sitk
>>> elastixImageFilter = sitk.ElastixImageFilter()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ElastixImageFilter'
>>>
你有什么主意可以帮忙吗?原因是什么?在
检查第一个示例中运行代码的目录
~/softwares/SimpleElastix/build/SimpleITK-build/Wrapping/Python
,第二个示例中~/workspace/registration
。可能这没有添加到PATH/LD_LIBRARY_PATH中。使用sys.path
检查path变量中是否存在该模块。在我只能通过将以下路径添加到终端上的
.bashrc
来解决这个问题相关问题 更多 >
编程相关推荐