pyenv-win管理windows上多个版本python

pyenv是一款管理多个python版本的工具,可以便捷的切换使用的python版本,但是不支持windows环境,在windows环境需要使用pyenv-win

pyenv-win安装

官方介绍的安装方式比较多,在此主要记录一下我习惯的安装方式

  1. 下载pyenv-win,可以从github上下载,也可这里下载
  2. 创建文件加.pyenv, 将下载文件解压到此目录
  3. 根据解压后的文件路径设置环境变量PYENV, PYENV_HOME and PYENV_ROOT,path,参考如图所示

PYENV, PYENV_HOME and PYENV_ROOT环境变量设置
path环境变量设置
4. 验证是否成功,在控制台中执行pyenv --version输出对应版本即表示成功

使用

pyenv的相关命令

C:\Users\Administrator>pyenv commands
--version
commands
duplicate
exec
export
global
help
install
latest
local
migrate
rehash
shell
shims
uninstall
update
version-name
version
versions
vname
whence
which

C:\Users\Administrator>pyenv version
3.12.2 (set by D:\Python\program\.pyenv-win\pyenv-win\version)

C:\Users\Administrator>pyenv versions
* 3.12.2 (set by D:\Python\program\.pyenv-win\pyenv-win\version)
  3.8.9

各option说明

   commands     List all available pyenv commands
   local        Set or show the local application-specific Python version
   latest       Print the latest installed or known version with the given prefix
   global       Set or show the global Python version
   shell        Set or show the shell-specific Python version
   install      Install 1 or more versions of Python
   uninstall    Uninstall 1 or more versions of Python
   update       Update the cached version DB
   rehash       Rehash pyenv shims (run this after switching Python versions)
   vname        Show the current Python version
   version      Show the current Python version and its origin
   version-name Show the current Python version
   versions     List all Python versions available to pyenv
   exec         Runs an executable by first preparing PATH so that the selected 
                Python version's `bin' directory is at the front
   which        Display the full path to an executable
   whence       List all Python versions that contain the given executable

注意:pyenv install 从 https://www.python.org/ftp/python获取安装包,可能会存在超时的情况,可以提前下载对应的安装包放到目录.pyenv-win\pyenv-win\install_cache\下,就可直接进行安装了

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
回答: pyenv是一种Python版本管理工具,可以用来改变全局的Python版本,安装多个版本Python,设置目录级别的Python版本,以及创建和管理虚拟环境。通过pyenv,可以实现对不同版本Python进行管理,并且可以通过virtualenv设置不同的虚拟环境对Python库的版本进行管理。这样,在程序运行的过程中,可以根据不同的运行需求使用不同的Python版本。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* [Python版本管理-pyenv](https://blog.csdn.net/peng78585/article/details/131767881)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [使用pyenv管理python版本](https://blog.csdn.net/Zhangsan0219/article/details/121237529)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Python版本管理工具之pyenv](https://blog.csdn.net/YiJie__ShuSheng/article/details/90448944)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值