安装Windows11 Python多版本控制 pyenv

Python多版本

安装pyenv

官方文档

https://github.com/pyenv/pyenv/blob/master/COMMANDS.md

pip install pyenv-win --target d:/.pyenv

windows11

执行下面3行代码

# 涉及到注册表问题,这里必须“以管理员身份运行”选项启动 Windows PowerShell

> Set-ExecutionPolicy  AllSigned
> Set-ExecutionPolicy -Scope CurrentUser Unrestricted

> Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
# 添加执行Win11执行脚本权限
> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

https://blog.csdn.net/weixin_43031092/article/details/113412866

添加环境变量

添加path

D:\.pyenv\pyenv-win\bin
D:\.pyenv\pyenv-win\shims

安装Windows11 Python多版本控制 pyenv_第1张图片

安装python虚拟环境 virtualenv

官方文档
https://virtualenv.pypa.io/en/latest/

pip install virtualenv
# 添加执行Win11执行脚本权限
> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser


# 创建虚拟环境
python -m venv env
# 进入虚拟环境
cd env/Scripts && activate && cd ../../

https://stackoverflow.com/questions/74966861/activating-python-virtual-environment-on-windows-11

你可能感兴趣的:(python)