Skip to content

Instantly share code, notes, and snippets.

@pocin
Last active April 22, 2024 15:54
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save pocin/c3e58af3b1f23ed62143b01f5c3f8904 to your computer and use it in GitHub Desktop.
Save pocin/c3e58af3b1f23ed62143b01f5c3f8904 to your computer and use it in GitHub Desktop.
Use conda+pyenv to manage python
# $ brew install pyenv #pay attention to caveats ($ brew info pyenv)
# $ brew install pyenv-virtualenv
# this goes into .zshrc
export PYENV_ROOT=/usr/local/var/pyenv
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
# USE LIKE THIs
# $ pyenv install miniconda3-latest
# $ pyenv global miniconda3-latest
# $ conda create -n my_conda_env requests
# $ pyenv versions
# system
#* miniconda3-latest (set by /Users/pocin/.python-version)
# miniconda3-latest/envs/my_conda_env
# to activate conda virtualenv do
# pyenv activate my_conda_env
# For activating conda env when entering directory
# $ cd /path/to/dir
# $ pyenv local my_conda_env
@jurukode
Copy link

jurukode commented Oct 6, 2018

Hey man @pocin, i unable to activate my_conda_env. I throw error like this:

pyenv-virtualenv: version `my_conda_env' is not a virtualenv

Any idea?

@arkottke
Copy link

arkottke commented Sep 1, 2021

If anyone else has an issue activating a conda environment. I had success with the following:

pyenv activate miniconda3-latest/envs/my_conda_env

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