http://blog.csdn.net/vencent7/article/details/76849849
The pyenv and pyenv-virtualenv that you have been using to manage different Python environments. Yesterday my friend recommended me to install a Anaconda (through the official website download installs with the graphical interface Anaconda Navigator version, is not through the pyenv installs), the result installs appears to be not very compatible with the original pyenv, searches on the net a bit, Have encountered a similar situation: Https://stackoverflow.com/questions/40944277/pyenv-and-anaconda-issue-with-export-path
After trying, I found the following solution:
Solve the PATH environment variable problem
Anaconda installation will be in .bash_profile
the last line to add their own PATH to the front, it is because of this cause pyenv failure (pyenv is also by adding their PATH to the most "hijack" python
and other commands to achieve multi-version management), Because according to the official installation instructions,Pyenv's several lines of command should be placed at .bash_profile
the end .
Therefore, edit the. Bash_profile so that the pyenv command is placed after the Anaconda:
# added by Anaconda3 4.4.0 installerexport path= "/users/frederic/anaconda/bin:< Span class= "hljs-variable" > $PATH "# pyenvexport PYENV_ROOT=< Span class= "hljs-string" > " $HOME/.pyenv" export PATH= " $PYENV _root/bin: $PATH" eval "$ (pyenv init-)" eval "$ (pyenv virtualenv-init- )"
Solve the problem of virtualenv identifying anaconda virtual Environments
With the above steps, PYENV/VIRTUALENV has a higher priority than anaconda, so if you run the version you see should be the version python -version
specified by pyenv instead of the Anaconda version.
However, how do I run the anaconda version of Python?
- If you have not created an environment and have only the default root, we need to create a new environment from the Conda or Anaconda Navigator graphical interface first.
- A soft link to the Environment folder
.pyenv/versions
that you just created, which allows pyenv/virtualenv to recognize the environment created by Anaconda (Anaconda that is installed through pyenv should be recognized directly, but my anaconda is installed independently, so the pyenv is not detected):ln -s ~/anaconda/envs/anaconda_env ~/.pyenv/versions/anaconda_env
- Now enter the PYENV versions command should be able to see the anaconda environment, can be virtualenv activate/deactivate command or PYENV command
pyenv shell/local/glocal [env_name]
switch version
Compatibility of Pyenv/virtualenv and Anaconda under Mac