window 安装 pyenv
- 下载工具: github.com/pyenv-win/p…
- 将整个包下载下来, 也就是clone->Download ZIP
-
下载完成后将文件夹放在到一个没有中文没有空格的路径当中
-
解压文件得到 pyenv-win-master 文件夹, 这里我放到D盘, 路径也就是 D:\ pyenv-win-master
-
打开cmd, 将路径指到D盘, 看如下
D: E:> rename pyenv-win-master .pyenv # 重命名文件夹,因为直接重命为.pyenv不可以,所以用cmd操作
- 配置环境变量,打开环境变量在系统变量下新建
- 在系统变量中找到 Path, 并添加 %PYENV%\bin 与 **%PYENV%\shims
- 打开cmd ,输入pyenv ,并输出如下, 就代表安装成功了
pyenv 3.1.1
Usage: pyenv <command> [<args>]
Some useful pyenv commands are:
commands List all available pyenv commands
duplicate Creates a duplicate python environment
local Set or show the local application-specific Python version
global Set or show the global Python version
shell Set or show the shell-specific Python version
install Install a Python version using python-build
uninstall Uninstall a specific Python version
update Update the cached version DB
rehash Rehash pyenv shims (run this after installing executables)
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
which Display the full path to an executable
whence List all Python versions that contain the given executable
See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv-win/pyenv-win#readme
widnow 国内无法下载或下载包过慢,使用国内镜像
-
当输入pyenv install 3.8.0 无法下载时可按如下操作
- 用vscode打开.pyenv/pyenv-win 搜索 www.python.org/ftp/python 并全部替换成 npm.taobao.org/mirrors/pyt…
pyenv\pyenv-win.versions_cache.xml pyenv-win\libexec\libs\pyenv-install-lib.vbs
-
可以放心安装python版本了
-
pip安装包过慢
- 新建pip.ini 内容如下
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
2. 在 User/英文用户名 新建一个pip文件夹,并将pip.ini文放进去
- 至此可以使用pip安装包了