Issues about import otbApplication in Spyder or PyCharm

#1

Hi
The otbApplication could be successfully imported in python in command lines. But, an error occurred when I try to import otbApplication in Spyder or Pycharm. It said:

Traceback (most recent call last):
File “D:\OTB-6.6.1-Win64\lib\python3\otbApplication.py”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “D:\Anaconda3\envs\zy_py35\lib\importlib_init_.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 958, in _find_and_load_unlocked
File “”, line 666, in _load_unlocked
File “”, line 577, in module_from_spec
File “”, line 903, in create_module
File “”, line 222, in _call_with_frames_removed
ImportError: DLL load failed: 找不到指定的模块。
During handling of the above exception, another exception occurred:

I have added the variables in otbenv.bat into system path. My platform is Win10 + python 3.5.

I’ll be appreciated if any hints can be given to help me build otbApplication in IDE.

Thanks

Yi Zhao

#2

Here is the command line information:

#3

And this is part of my system variables
image
I am not sure whether it is necessary to add those variables.

#4

Hi Yi Zhao,
As far as I understand, it is an environment issue. What is the environment under pycharm or spyder?

#5

Hi Anatoine
Thanks for your reply.
The import error does cause by my environment setting. My python IDE is spyder within anaconda3 in Win 10. But the default version is 3.7 so I create a new workspace with python 3.5. By now, it still reports the error in Win 10, even if I set up environment variables with sys.path.append() and os.environ[ ]. The good news is I can import successfully in Linux environment. It is a little weird.
But new issues takes place when I tried to build otbtf. The tutors in github is a little complicated to me. Do you have any experiences about it?
I will be appreciated if you can help me to figure it out.
Hope for your