Reputation: 2226
I have followed the SimpleElastix
installation in the link. When I run the following command to install the python wrapper of SimpleElastix, it is successfully running and can import the packages:
sudo python Packaging/setup.py install
and I can import the packages and use the function as follows:
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()
>>>
However, once I exit from the python terminal to the bash, and changing to python terminal command line again, it does not recognize the function:
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'
>>>
Do you have any idea to help with this? What is the reason?
Upvotes: 0
Views: 1753
Reputation: 2226
I could only solve this issue by adding the following path to the .bashrc
on the terminal
export PYTHONPATH=$PYTHONPATH:/home/user/softwares/SimpleElastix/build/SimpleITK-build/Wrapping/Python
Upvotes: 1
Reputation: 269
Check the directory you were running the code from ~/softwares/SimpleElastix/build/SimpleITK-build/Wrapping/Python
in first example and ~/workspace/registration
in second. Maybe this is not added to the PATH/LD_LIBRARY_PATH. Check if the module exists in your path variable using sys.path
.
Upvotes: 1