Blog

Blog

PHODAL

Python 版本管理 pyenv pythonbrew

Mac OS上安装gevent的时候遇到点麻烦,看到网上有这样的东西,先看看python homebrew,值得注意的是这个包已经不再维护了。

pythonbrew

安装 pythonbrew

curl -kL http://xrl.us/pythonbrewinstall | bash

再把下面这个添加到~/.bash_profile

 [[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc

有意思的是在我的~/.bash_profile里面还有一个

 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

pythonbrew用法

  • 列出可安装的 python 版本:pythonbrew list --know
  • 安装某个版本的 python : pythonbrew install 2.7.3
  • 删除已安装的某版本的 python : pythonbrew uninstall 2.7.3
  • 列出已安装的 python 版本(当前使用的版本后会用星号标记):pythonbrew list
  • 。。。

就不再copy了,这是一个不再维护的包。上面推荐了一个pyenv

Mac OS pyenv

安装pyenv

用的自然是brew

brew update
brew install pyenv

问题是python的版本会有ruby那么混乱么?

pyenv用法

试试

 pyenv --help

于是就有了

  • commands List all available pyenv commands
  • 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
  • rehash Rehash pyenv shims (run this after installing executables)
  • version Show the current Python version and its origin
  • versions List all Python versions available to pyenv
  • which Display the full path to an executable
  • whence List all Python versions that contain the given executable

python需要版本管理么?


或许您还需要下面的文章:

关于我

Github: @phodal     微博:@phodal     知乎:@phodal    

微信公众号(Phodal)

围观我的Github Idea墙, 也许,你会遇到心仪的项目

QQ技术交流群: 321689806
comment

Feeds

RSS / Atom

最近文章

关于作者

Phodal Huang

Engineer, Consultant, Writer, Designer

ThoughtWorks 技术专家

工程师 / 咨询师 / 作家 / 设计学徒

开源深度爱好者

出版有《前端架构:从入门到微前端》、《自己动手设计物联网》、《全栈应用开发:精益实践》

联系我: h@phodal.com

微信公众号: 最新技术分享

标签