I would like to use conda to create different environments, each with a different $PYTHONPATH. Currently, I have to change the environment variables each time in my .bashrc. Is there a simple way of creating multiple python environments via conda, such that I can seamless switch (via source activate) and have the corresponding $PYTHONPATHs update automatically?
While you can have multiple environments that contain different versions of Python at the same time on the same computer, you can't set up 32- and 64-bit environments using the same Conda management system.
You can always use conda activate or conda deactivate to switch between your environments. You can directly activate the environment you wish to use by using conda activate . conda deactivate will deactivate your current active environment and change to the default environment which is the base environment.
There is no need to set the PYTHONPATH environment variable. To see if the conda installation of Python is in your PATH variable: On macOS and Linux, open the terminal and run echo $PATH . On Windows, open an Anaconda Prompt and run echo %PATH% .
You can specify the PYTHONPATH before you execute any script, which would be easier than changing your .bashrc
For example, to put the current working directory on the path before executing any script, you can do this
PYTHONPATH=`pwd`: python
If you didn't want to overwrite the entire path, but just append to it
PYTHONPATH=`pwd`:$PYTHONPATH python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With