pyenv install --list
顯示本地版本很低,官網(wǎng)已經(jīng)到3.9.7
如何有效更新pyenv獲取最新完整的Python安裝清單呢
1、在 "$PYENV_ROOT"/cache/
目錄下存放一個(gè)文件名為 Python-3.9.7.tar.xz
注意這里可以是文件,主要是有要這樣的一個(gè)名字的文件, 其實(shí) 核心
是里面的版本號(hào)高于你本地最新的哪個(gè)版本都行
思考:
為什么要在 "$PYENV_ROOT"/cache/
下存放文件呢?
參考:《pyenv ~/.pyenv/cache 不生效問題》
2、執(zhí)行 pyenv install 3.9.7
這個(gè)時(shí)候其實(shí)會(huì)查詢本地緩存文件夾看是否有,有的話會(huì)優(yōu)先從這里找安裝文件,而不會(huì)去網(wǎng)上下載
這時(shí),緩存找到
3.9.7
但是本地pyenv list
中最新版本卻是低于3.9.7
的,比如我的本地是3.6.6
;所有會(huì)有如下報(bào)錯(cuò)
(demos) ? ansibleDemo pyenv install 3.9.9
python-build: definition not found: 3.9.9
See all available versions with `pyenv install --list'.
If the version you need is missing, try upgrading pyenv:
cd /Users/xxxxx/.pyenv/plugins/python-build/../.. && git pull && cd -
3、安裝提示執(zhí)行 cd /Users/xxxxx/.pyenv/plugins/python-build/../.. && git pull && cd -
注意其中 xxxx 路徑換成自己的
4、執(zhí)行成功之后再次執(zhí)行 pyenv install --list
就可以看到本地最新到3.9.7
image.png