6
pyenv,轻松切换各种python版本
source link: https://blog.51cto.com/u_15317033/5611592
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
pyenv,轻松切换各种python版本
精选 原创pyenv,轻松切换各种python版本
解决什么问题
- mac自带python2,md又不能删掉他
- linux也自带python2,这玩意都过时了,也不赶紧换掉
安装pyenv
git 安装
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
bash 环境,就依次执行如下命令:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
zsh 环境,就依次执行如下命令:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
➜ ~ pyenv versions
system
* 3.7.3 (set by /Users/cuifuan/.pyenv/version)
# 国内源
wget http://mirrors.sohu.com/python/3.7.3/Python-3.7.3.tar.xz -P ~/.pyenv/cache
# 安装
pyenv install 3.7.3
等个5分钟,让子弹飞一会,返回如下
➜ ~ pyenv install 3.7.3
pyenv: /Users/cuifuan/.pyenv/versions/3.7.3 already exists
continue with installation? (y/N) y
python-build: use [email protected] from homebrew
Installing readline-8.0...
Installed readline-8.0 to /Users/xxx/.pyenv/versions/3.7.3
Installing Python-3.7.3...
python-build: use zlib from xcode sdk
Installed Python-3.7.3 to /Users/xxx/.pyenv/versions/3.7.3
查看系统现在的python版本
➜ ~ pyenv versions
system
* 3.7.3 (set by /Users/cuifuan/.pyenv/version)
zsh: command not found: wget
brew install wget
## 假如是centos
yum install wget
## ubuntu
apt-get install wget
- 打赏
- 赞
- 收藏
- 评论
- 分享
- 举报
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK