我已经按照链接SimpleElastix
中的安装进行了操作。当我运行以下命令安装 SimpleElastix 的 python 包装器时,它运行成功并且可以导入包:
sudo python Packaging/setup.py install
我可以导入包并使用如下功能:
user@user-XPS-8920:~/softwares/SimpleElastix/build/SimpleITK-build/Wrapping/Python$ 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()
>>>
但是,一旦我从 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'
>>>
你有什么想法可以帮助解决这个问题吗?是什么原因?