2017-05-22 26 views
0

我正在嘗試升級Linux Box中的Python版本。通過廚師食譜在Linux中安裝python2.7

[[email protected] ~]# python --version 
Python 2.6.6 
[[email protected] ~]# 

我跑:

yum install python27 

,並在此之後,以反映蟒蛇2.7版本,我運行:

scl enable python27 bash 

當前會話它給

[[email protected] ~]# python --version 
Python 2.7.8 
[[email protected] ~]# 

當我正在寫作時廚師的菜譜,我的食譜是這樣的:

# install python27 package 
yum_package 'python27' do 
action :install 
end 

# enable python27 bash 
execute 'python27_bash' do 
    command 'scl enable python27 bash' 
end 

,我致電本食譜中的節點,但它不是升級到python2.7當前會話。

+0

檢查廚師客戶端的輸出 – AlexD

+0

我已將菜譜添加到運行列表中並稱爲「廚師客戶端」。 但沒有運氣。 – joy

回答

0

所以當你運行scl enable python27 bash它實際上是從你當前的shell中產生一個新的Bash進程。由於SCL的工作原理,您只能啓用它們以實現新的過程。使用poise-python食譜來解決這個問題,它的python_runtime資源有一個SCL提供者,它爲你處理內部魔法。