ylikx / forpy

Forpy - use Python from Fortran
GNU Lesser General Public License v3.0
212 stars 51 forks source link

problem running example "intro_to_forpy.F90" #43

Open Jonas231 opened 2 years ago

Jonas231 commented 2 years ago

Hello, I am a Fortran beginner and would like to use forpy for some plotting using matplotlib and later pyvista.

I tried your first and easiest example:

gfortran -c forpy_mod.F90 gfortran intro_to_forpy.F90 forpy_mod.o python3-config --ldflags --embed

And a file a.out was created. When I call ./a.out I get this error message:

./a.out: error while loading shared libraries: libpython3.9.so.1.0: cannot open shared object file: No such file or directory

Do you have an idea what to do next? Best regards, Jonas

Jonas231 commented 2 years ago

I found this: https://gitlab.dkrz.de/m300872/rain-on-python/-/blob/master/forpy/usage_log.md

Jonas231 commented 2 years ago

Okay. I had to query: which python Then use: export LD_LIBRARY_PATH=/home/jonas/miniconda3/lib:$LD_LIBRARY_PATH

gfortran -c forpy_mod.F90 gfortran intro_to_forpy.F90 forpy_mod.o python3-config --ldflags --embed

./a.out

Now it works.