简体   繁体   中英

Why is python console not picking up pyenv global version?

ishandutta2007@MacBook-Pro:~$ python --version
 Python 2.7.15 
 ishandutta2007@MacBook-Pro:~$ pyenv versions
  system 2.7 * 3.7.0 (set by /Users/ishandutta2007/.pyenv/version) 
 ishandutta2007@MacBook-Pro:~$ pyenv global 3.7.0
 ishandutta2007@MacBook-Pro:~$ pyenv versions
  system 2.7 * 3.7.0 (set by /Users/ishandutta2007/.pyenv/version) 
ishandutta2007@MacBook-Pro:~$ python --version
 Python 2.7.15 
ishandutta2007@MacBook-Pro:~$ python
 Python 2.7.15 (default, Jun 17 2018, 12:46:58) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. 

you need to add:

eval "$(pyenv init -)" 

in your .bash_profile or .bashrc

The issue was I needed to add this in my bash_profile

if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM