Sunday, June 11, 2017

Virtual environment path

from python command line:

>>os.environ will return the enviroment env settings


>>> os.environ
environ({'PS1': '(py35) \\[\\e[0;33m\\]\\h:\\W \\u\\$\\[\\e[m\\] ', 'USER': 'dc', 'CONDA_HOME': '/Users/dc/anaconda', 'GROOVY_HOME': '/Users/dc/groovy-2.4.6', 'PWD': '/Users/dc', 'Apple_PubSub_Socket_Render': '/private/tmp/com.apple.launchd.SUBHxwa0rm/Render', 'COMMAND_MODE': 'unix2003', 'VLC_PLUGIN_PATH': '/Applications/VLC.app/Contents/MacOS/plugins:/Applications/VLC.app/Contents/MacOS/', 'LOGNAME': 'dc', 'TERM_PROGRAM': 'iTerm.app', 'TMPDIR': '/var/folders/mb/br6t4l8d5svbdx8w4r966y1w0000gn/T/', 'JAVA_HOME': '/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/', 'LSCOLORS': 'cxFxBxDxCxegedabagacad', 'SHELL': '/bin/bash', 'COLORFGBG': '7;0', 'LANG': 'en_US.UTF-8', 'ITERM_PROFILE': 'Default', 'DISPLAY': '/private/tmp/com.apple.launchd.uEPD8pQyDf/org.macosforge.xquartz:0', 'MAC_JAVA': '/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/MacOS', 'TERM_PROGRAM_VERSION': '3.0.15', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.LFYhVBried/Listeners', 'TERM_SESSION_ID': 'w0t0p1:6C68B3C0-5374-4E9C-B424-125BAB6B03F4', 'CONDA_PS1_BACKUP': '\\[\\e[0;33m\\]\\h:\\W \\u\\$\\[\\e[m\\] ', 'SECURITYSESSIONID': '186a8', 'ITERM_SESSION_ID': 'w0t0p1:6C68B3C0-5374-4E9C-B424-125BAB6B03F4', 'CONDA_PREFIX': '/Users/dc/anaconda/envs/py35', 'XPC_FLAGS': '0x0', 'CONDA_DEFAULT_ENV': 'py35', 'ITERM_ORIG_PS1': '(py35) \\[\\e[0;33m\\]\\h:\\W \\u\\$\\[\\e[m\\] ', 'PATH': '/Users/dc/anaconda/envs/py35/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/MacOS:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home//bin:/Users/dc/apache-maven-3.3.9/bin:/Users/dc/anaconda/bin:/Users/dc/gradle-2.11/bin:/Users/dc/groovy-2.4.6/bin:/usr/local/include:/usr/local/lib:/usr/local/Cellar/opencv/2.4.13/include:/usr/local/Cellar/opencv/2.4.13/lib', '_': '/Users/dc/anaconda/envs/py35/bin/python', 'OLDPWD': '/Users/dc', 'ITERM_PREV_PS1': '\\[\x1b]133;D;$?\x07\x1b]1337;RemoteHost=dc@localhost\x07\x1b]1337;CurrentDir=/Users/dc\x07\x1b]133;A\x07\\](py35) \\[\\e[0;33m\\]\\h:\\W \\u\\$\\[\\e[m\\] \\[\x1b]133;B\x07\\]', 'HOME': '/Users/dc', 'CLICOLOR': '1', 'CONDA_PATH_BACKUP': '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/MacOS:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home//bin:/Users/dc/apache-maven-3.3.9/bin:/Users/dc/anaconda/bin:/Users/dc/gradle-2.11/bin:/Users/dc/groovy-2.4.6/bin:/usr/local/include:/usr/local/lib:/usr/local/Cellar/opencv/2.4.13/include:/usr/local/Cellar/opencv/2.4.13/lib', 'XPC_SERVICE_NAME': '0', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'MAVEN_HOME': '/Users/dc/apache-maven-3.3.9', 'GRADLE_HOME': '/Users/dc/gradle-2.11', 'TERM': 'xterm-256color', 'SHLVL': '1'})



From the above we can see we should use echo $CONDA_PREFIX as the equivalent to $VIRTUAL_ENV


No comments:

Post a Comment