osx - having default Mac Python 2.7 and Anaconda Python 3 -


i want keep mac python main 'python'. reason recommendation in python website here. want add separate environment python3 (anaconda).

for doing installed anaconda python access conda , made environment python3 using following command:

conda create -n py36 python=3.6 anaconda 

when installed anaconda python added .bash_profile file access conda commands:

# added anaconda3 4.4.0 installer # export path="/users/omidb/anaconda/bin:$path" 

now default python anaconda python don't want to.

how can have default mac python main python , when needed anaconda, use source activate py36 ?

updated answer

after testing this, feel it's appropriate offer simple solution using mac python default , using conda python when desired.

you need add/move conda path end of path environment via export command. should allow use mac python default , use anaconda python after calling source activate py36.

export path="$path:/users/omidb/anaconda/bin" 

path resolution

this solution assumes have /usr/bin/ (where mac python is) in path. resolution order should check directory first assuming it's first in path. also, setup not require symlinks in /usr/local/bin. not fan of manipulating system-level resources solutions can done user resources (directories).

default python setup

after moving anaconda path end of path environment variable, can validate which python references /usr/bin/python, location mac python. run mac python default @ command line.

running conda python

as noted, have call source activate py36 when want use conda virtual environment. there no need adding symlinks /usr/local/bin available through ~/anaconda/bin/.

furthermore, source activate py36 (or other anaconda environment), add appropriate environment path anaconda python beginning of path environment variable, (referring path resolution) executed when run python on command line. can validate which python after running source activate py36. conda stores previous path environment variable conda_path_backup.

deactivating conda

after running source deactivate, original path restored, running mac python.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -