I am trying to start using Python with QGIS but I cannot get Python to work right. When I try import qgis.code
in the python shell, I get this:
Traceback (most recent call last): File "<pyshell#0>", line 1, in import qgis.core ModuleNotFoundError: No module named 'qgis'
Then I go into Terminal and try this:
export PYTHONPATH=/Applications/QGIS.app/Contents/Resources/python
But my error message stays the same. Interestingly, if I try running python from Terminal and try to import qgis again, I get a different error code:
Traceback (most recent call last): File "", line 1, in File "/Applications/QGIS.app/Contents/Resources/python/qgis/core/__init__.py", line 25, in from qgis._core import * ImportError: dlopen(/Applications/QGIS.app/Contents/Resources/python/qgis/_core.so, 2): Library not loaded: @rpath/qgis_core.framework/Versions/3.18/qgis_core Referenced from: /Applications/QGIS.app/Contents/Resources/python/qgis/_core.so Reason: image not found
I have two versions of Python on my computer (Mac) which has caused so many problems for me; could that be the problem? How do I fix this? I tried following this: QGIS - ModuleNotFoundError but I don't know where to go from there. I am a programming noob so I don't even know what to fix there.