1

If I open Spyder via the window taskbar (i.e clicking on the search button in the lower left, typing "spyder", and clicking on the app), I can get a list of environmental variables with list(os.environ.keys())

If I then open Spyder through an Anaconda Prompt (i.e. opening an Anaconda Prompt window, typing in "spyder", and hitting enter), and do the same thing, several extra environmental variables show up.

These are the variables which show up in list(os.environ.keys()) in Spyder opened through the Anaconda Prompt, but do not appear in the Spyder instance opened through the Windows taskbar:

['CONDA_DEFAULT_ENV',
 'CONDA_EXE',
 'CONDA_PROMPT_MODIFIER',
 'CONDA_PYTHON_EXE',
 'CONDA_SHLVL',
 'GDAL_DATA',
 'GEOTIFF_CSV',
 'PROJ_LIB',
 'PROJ_NETWORK',
 'PROMPT']

I want all of these above to also be set when I open Spyder through the taskbar. Specifically, I need the 'GDAL_DATA' variable to be set.

What's going on, and how can I fix it?

Thanks.

1 Answer 1

1

I'm not sure, but when opening Anaconda, it initializes the environments for you. Using Spyder by itself means your python environment needs to be initialized manually. I use a batch file to open environments.

@call C:\path-to\.virtualenvs\Scripts\activate.bat base
@start \path-to\spyder.exe

activate.bat activates the environment base. Assign a shortcut on your desktop to run the batch file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.