Trying to import gdal from osgeo and I'm getting this error;
ImportError: DLL load failed while importing _gdal: The specified module could not be found. On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH. If gdalXXX.dll is in the PATH, then set the USE_PATH_FOR_GDAL_PYTHON=YES environment variable to feed the PATH into os.add_dll_directory().
I have seen this error referenced in a number of places but no solution that I can see, some suggest using conda or miniconda to make a virtual environment but that isn't an option for me. I just want to be able to use gdal from my QGIS python console and pyCharm console directly.
What does this error mean? How can I set my USE_PATH_FOR_GDAL_PYTHON=YES? Do I use OSGeo4W Shell? Do I need to edit a BAT file? How is os.add_dll_directory() used to feed the PATH? What PATH is it looking for? Am I just importing gdal incorrectly with from osgeo import gdal? Is there another way to import gdal? OS Windows 10, OSGeo4W installed on C:, QGIS 3.22.6, PyCharm 2021.1.1, Python3.9(C:\OSGeo4W\apps\Python39\python.exe)