2015-10-24 14 views
11

Python2 ve python3'ü değiştirmek için pyenv kullanmak istiyorum.Python'u pyenv ile değiştiremiyor

Aşağıdaki kodları kullanarak python2 ve python3 ve pyenv dosyalarını başarıyla yükledim.

brew install pyenv 

brew install pyenv-virtualenv 

pyenv install 2.7.10 

pyenv install 3.5.0 

Ancak, ben .. python2 gelen python3 için

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$ 

bunun neden böyle anlamıyorum geçemezsiniz. Bilgileriniz için

. Python'um bu dizinde.

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

Şimdiden teşekkür ederiz.

+0

Sadece .bashrc dosyanızı düzenleyebilirsiniz. Dosyaya göre python = Python3.5.0 –

cevap

30

bu deneyin: eval "$ (pyenv init -)"

örnek:

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

bilgileri daha: https://github.com/yyuu/pyenv

5

You 1 satıra bu eval "$(pyenv init -)" eklemeyi unutmuşum. bash_profile dosyası (Mac kullanıyorsanız) veya .bashrc dosyası.

+0

yapın ve dosyanın sonuna doğru olmalı – Jonathan