Can you please treat this a bit more seriously like you would any other (research project)? also let me remind you, again, that I don’t see what you are doing. However precise information is needed to reproduce and retrace your steps to be able to tell where you went wrong.
The lammps version I am using is the newest one.
That is a very imprecise and unscientific description. “the newest” depends on the day when somebody is reading it and thus would mean something else to somebody looking up my answers in the mailing list archives next month (or next year). also there are always at least three different “newest” versions, the “develop” branch of the git repository, the “newest” patch release and the “newest” stable release. How to determine the version is also prominently explained in the manual: https://docs.lammps.org/Manual_version.html
The Makefile I used is openmpi_gcc.
There is no such makefile in the LAMMPS distribution.
In the Src directory, I used command” make mode=shared openmpi_gcc”
Because there is not openmpi_gcc you should not have compiled LAMMPS as a shared library, but instead should have received an error message.
It is important that you carefully observe and report your observations (again, standard scientific procedure, i.e. something that you should know well).
and “make install-python”.
again, since you apparently didn’t compile a shared library, there should have been an error.
After that, I tried import lammps in python environment, it works. But when I tried to run some example files in python directory, error shown as I described.
which means, that you must done some other (random?) steps, because the import should have failed completely and not produce the error you are reporting.
Thanks for your help.
because your information is incomplete, vague, inaccurate, and unreliable, there is next to nothing that I can do here. for people that have so little experience with compiling software and making so many errors, we generally recommend to install CMake and follow the CMake based build instructions instead.