prepend(而不是追加)virtualenv路径登录shell $ PATH

时间:2014-08-27 01:11:59

标签: python macos shell virtualenv zsh

为什么我的virtualenv路径会附加到登录shell的$ PATH变量中?是否可以将它添加到首先进行搜索?

Last login: Tue Aug 26 18:35:15 on ttys000
➜  ~  . ./venvs/py_venv/bin/activate
(py_venv)➜  ~  echo $PATH
/Users/aj/venvs/py_venv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
(py_venv)➜  ~  zsh -l -c 'echo $PATH'
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/aj/venvs/py_venv/bin
(py_venv)➜  ~

这是我的.zshrc文件:https://gist.github.com/ajw0100/b10672e065977793ac79

1 个答案:

答案 0 :(得分:0)

没关系。是我的配置中的东西。我卸载了oh-my-zsh跑了rm -rf .zsh*并重新安装了oh-my-zsh,现在它可以工作了:

Last login: Tue Aug 26 19:01:26 on ttys000
➜  ~  echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
➜  ~  . ./venvs/py_venv/bin/activate
(py_venv)➜  ~  echo $PATH
/Users/aj/venvs/py_venv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
(py_venv)➜  ~  zsh -l -c "echo $PATH"
/Users/aj/venvs/py_venv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
(py_venv)➜  ~