then I install pycharm and then I copy an example code and find out that the error No module named ‘fenics’, I have do some research, but none of them solves my problem
This is a pycharm issue, as fenics is installed in at /usr/lib/petsc/lib/python3/dist-packages/
You need to ensure that this pythonpath is exposed to pycharm.
I just change the python interpreter to /usr/bin/python3 and it works, I think I install python and fenics with ubuntu with python3, but the interpreter in pycharm is a different one