网站首页 > 开源技术 正文
安装 pyenv
~ % brew install pyenv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 19 formulae.
......
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
把pyenv加到环境变量PATH里面
~ % echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
~ % more ~/.zshrc
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
重新启动shell,检查pyenv 安装成功
~ % exec "$SHELL"
~ % pyenv help
Usage: pyenv <command> [<args>]
Some useful pyenv commands are:
--version Display the version of pyenv
commands List all available pyenv commands
exec Run an executable with the selected Python version
global Set or show the global Python version(s)
help Display help for a command
hooks List hook scripts for a given pyenv command
init Configure the shell environment for pyenv
install Install a Python version using python-build
local Set or show the local application-specific Python version(s)
prefix Display prefix for a Python version
rehash Rehash pyenv shims (run this after installing executables)
root Display the root directory where versions and shims are kept
shell Set or show the shell-specific Python version
shims List existing pyenv shims
uninstall Uninstall a specific Python version
version Show the current Python version(s) and its origin
version-file Detect the file that sets the current pyenv version
version-name Show the current Python version
version-origin Explain how the current Python version is set
versions List all Python versions available to pyenv
whence List all Python versions that contain the given executable
which Display the full path to an executable
安装多版本python
~% pyenv install 2.7.6
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-2.7.6.tgz...
-> https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
......
如果有错误发生,在这个链接里面找一找解决方法 :https://github.com/pyenv/pyenv/wiki/Common-build-problems
安装成功后,python 安装在: /Users/xxx/.pyenv/versions/2.7.6/bin
安装其它版本python 也是在这个versions目录下面
设定当前工作的python版本
~%pyenv global 2.7.6
好了,看使用python多版本开发吧
猜你喜欢
- 2024-09-12 python安装并使用虚拟环境virtualenv
- 2024-09-12 Python 开发工具链全解(python开发工具选择)
- 2024-09-12 送给Python初学者的几点建议(python初学者推荐书籍)
- 2024-09-12 JSShell:一个基于python的交互式Shell
- 2024-09-12 多人在用,一款实用的Python开发环境管理神器
- 2024-09-12 AI革新OCR:LLM-Aided OCR,让PDF文本提取飞起来!
- 2024-09-12 python使用(一) virtualenv实现原理解析
- 2024-09-12 使用python的虚拟环境virtualenv(python虚拟环境作用)
- 2024-09-12 终极版Python学习教程:一篇文章讲清楚Python虚拟环境
- 2024-09-12 编程语言哪家强?谁是王者谁是青铜?
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- jdk (81)
- putty (66)
- rufus (78)
- 内网穿透 (89)
- okhttp (70)
- powertoys (74)
- windowsterminal (81)
- netcat (65)
- ghostscript (65)
- veracrypt (65)
- asp.netcore (70)
- wrk (67)
- aspose.words (80)
- itk (80)
- ajaxfileupload.js (66)
- sqlhelper (67)
- express.js (67)
- phpmailer (67)
- xjar (70)
- redisclient (78)
- wakeonlan (66)
- tinygo (85)
- startbbs (72)
- webftp (82)
- vsvim (79)
本文暂时没有评论,来添加一个吧(●'◡'●)