Created
September 23, 2024 06:10
-
-
Save tsibley/e7995ba4db05ffd21da563ee9fd08f0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create Conda env with ctng-compiler-activation package installed. | |
$ micromamba create -p /tmp/conda -c conda-forge --override-channels gcc_linux-64 | |
# Set HOST as a *shell variable*. | |
$ HOST=whunk | |
# It's visible to the shell… | |
$ echo $HOST | |
whunk | |
# …but not part of the inherited environment (i.e. not exported). | |
$ python3 -c 'import os; print(os.environ.get("HOST"))' | |
None | |
# Activate the Conda environment, which sources the ctng-compiler-activation | |
# scripts, e.g. /tmp/conda/etc/conda/activate.d/activate-gcc.sh. | |
$ conda activate /tmp/conda | |
# The activation script sets HOST… | |
$ echo $HOST | |
x86_64-conda-linux-gnu | |
# …and exports it into the inherited environment. | |
$ python3 -c 'import os; print(os.environ.get("HOST"))' | |
x86_64-conda-linux-gnu | |
# Deactivate the Conda environment, which sources the ctng-compiler-activation | |
# scripts, e.g. /tmp/conda/etc/conda/deactivate.d/deactivate-gcc.sh. | |
$ conda deactivate | |
# The deactivation script restores the old HOST value… | |
$ echo $HOST | |
whunk | |
# …but leaves it exported into the inherited environment. | |
$ python3 -c 'import os; print(os.environ.get("HOST"))' | |
whunk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment