I installed miniconda for some software I need to run. It worked great, but it made all of the other web related stuff I have set up through mac's default python environment stop working. What I would like to have is the mac python environment as the default and conda only when I need to run this specific software. So I would need to know #1 - how do I modify .bash_profile to allow me to run both environments, and #2 - the command I need to switch between environments (if there is one).
My bash profile looks like:
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
# added by Miniconda3 4.3.21 installer
# export PATH="/Users/mikeheavers/miniconda3/bin:$PATH"
(I have commented out the conda path for now)
Thanks!
Have you considered using Python's Virtual env?
This allows you to have a completely separate Python installations without causing conflicts with your main python in your path. This sounds ideal for your development needs.
You would need to "activate" the virtualenv prior to starting up miniconda, which will adjust your environmental variables such that the virtualenv python, and it's libraries will be used.
(copying from the link)
This will result in a virtual python installation
$ pip install virtualenv
$ cd my_project_folder
$ virtualenv my_project
$ source my_project/bin/activate
$ # Do stuff, like install from pip
$ deactivate # This will turn off the virtual python in your path
you can use this interpreter in your bashrc too (Check out the link for a more in depth introduction)
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7