Skip to content

Instantly share code, notes, and snippets.

@appleshan
Last active August 5, 2018 10:24
Show Gist options
  • Save appleshan/70cc730d7fefa348dd844f9e59cbec2e to your computer and use it in GitHub Desktop.
Save appleshan/70cc730d7fefa348dd844f9e59cbec2e to your computer and use it in GitHub Desktop.

python 的 autoenv 使用简明手册

kennethreitz/autoenv

只需了解:

  • 当进入目录,载入: .env
  • 当离开目录,载入: .env.leave

安装

当只使用 kennethreitz/autoenv, 先使用 git 方式安装了 autoenv 。

配置

  • .zshrc
source ~/.autoenv/activate.sh
export AUTOENV_ENABLE_LEAVE=true
  • .env
. /home/appleshan/.local/share/virtualenvs/test_pipenv-iVWx5v4Q/bin/activate
  • .env.leave
deactivate

Tarrasch/zsh-autoenv

只需了解:

  • 当进入目录,载入: .autoenv.zsh
  • 当离开目录,载入: .autoenv_leave.zsh

安装

当只使用 Tarrasch/zsh-autoenv, 使用 git 方式安装了 zsh-autoenv 。

配置

  • .zshrc
source ~/.oh-my-zsh/custom/plugins/zsh-autoenv/autoenv.zsh
  • .autoenv.zsh
echo "进入 pipenv.";
. /home/appleshan/.local/share/virtualenvs/test_pipenv-iVWx5v4Q/bin/activate

或者

echo "进入 pipenv.";
. ./.venv/bin/activate
  • .autoenv_leave.zsh
deactivate
echo "离开了 pipenv.";

参考资料

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment