How to work with multiple version of GDAL on windows os

After I have installed QGIS from OSGeo4w and added some enviroment of GDAL to the system path on my windows 10 computer, I get some error information from SNAP GPT command line, like below:

INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
ERROR 1: Can’t load requested DLL: C:\OSGeo4W64\bin\gdalplugins\gdal_ECW_JP2ECW.dll
126: can not find module

ERROR 1: Can’t load requested DLL: C:\OSGeo4W64\bin\gdalplugins\ogr_SOSI.dll
126: can not find module

However, the gpt program seems still work on (for processing sentinel-1), and I get the anticipated result map as usual. But I am not sure whethere there is some process failed. The error infomation exists even after I have removed all the environment related to GDAL from the system path (I have not restart the computer).

I have checked that gdal used by the snap seems to be included in the “” file as below,

#SNAP configuration ‘s2tbx’
#Sun Jul 26 08:06:53 CST 2020
s2tbx.dataio.maxTime=One week

I wonder how can I fix the gdal warnings/errors with more than one gdal version installed on the computer?

which ones and why? QGIS finds its libraries without setting variables, and you don’t risk mixing different instances.

I have added GDAL_DATA, GDAL_DRIVER_PATH, PYTHON, PROJ_LIB et al to the system environment in order to use the QGIS module standlone from python.
Sorry for post this question in a hurry. Now I have fixed the problem by removing all the environment and restart the computer. It is better do this by temperally change the environment in the python environment.

You can put some code to your Python launcher or even at the beginning of your code (e.g. as a separate function “import-paths”) to include these directories.