Python – Temporarily set ENV variable for just one shell command

environment-variablespythonshell

Is it possible to set an ENV variable for just one shell command (ie make it expire right after the command executes)?

For example:

export VERSIONER_PYTHON_PREFER_32_BIT=yes
winpdb

I'd like to set my system to use 32bit Python for just this command, then go back to 64bit. Maybe something like

VERSIONER_PYTHON_PREFER_32_BIT=yes; winpdb

Thanks!

Best Answer

in Bash, you can do VERSIONER_PYTHON_PREFER_32_BIT=yes winpdb and the env variable is set for the command. Same as you propose but without semi-colon.