2015-10-24 8 views
11

Vorrei usare pyenv per passare a python2 e python3.Impossibile passare a Python con pyenv

Ho scaricato con successo python2 e python3 e pyenv con i seguenti codici.

brew install pyenv 

brew install pyenv-virtualenv 

pyenv install 2.7.10 

pyenv install 3.5.0 

Tuttavia, non posso passare da python2 a python3 ..

Soma-Suzuki:~ Soma$ python --version 
Python 2.7.10 
Soma-Suzuki:~ Soma$ pyenv global 
2.7.10 
Soma-Suzuki:~ Soma$ pyenv versions 
    system 
* 2.7.10 (set by /Users/Soma/.pyenv/version) 
    3.5.0 
Soma-Suzuki:~ Soma$ pyenv global 3.5.0 
Soma-Suzuki:~ Soma$ pyenv global 
3.5.0 
Soma-Suzuki:~ Soma$ pyenv versions 
    system 
    2.7.10 
* 3.5.0 (set by /Users/Soma/.pyenv/version) 
Soma-Suzuki:~ Soma$ python --version 
Python 2.7.10 
Soma-Suzuki:~ Soma$ 

non capisco il motivo per cui questo accade.

Per vostra informazione. Il mio pitone si trova in questa directory.

Soma-Suzuki:~ Soma$ which python 
/usr/bin/python 

Grazie in anticipo.

+0

È sufficiente modificare il file .bashrc. Crea alias python = Python3.5.0 –

risposta

30

provare questo: eval "$ (pyenv init -)"

esempio:

$ python -V 
Python 2.7.9 
mac:~ $ eval "$(pyenv init -)" 
mac:~ $ python -V 
Python 3.5.0 

maggiori informazioni: https://github.com/yyuu/pyenv

5

Si è dimenticato di aggiungere questo eval "$(pyenv init -)" alla prima riga. file bash_profile (se stai usando un Mac) o file .bashrc.

+0

per la documentazione che dovrebbe essere verso la fine del file – Jonathan

Problemi correlati