文章插图
安装 pyenv~ % brew install pyenv
Updating Homebrew...==> Auto-updated Homebrew!Updated 1 tap (homebrew/core).==> Updated FormulaeUpdated 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; thenn 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.6python-build: use openssl from homebrewpython-build: use readline from homebrewDownloading 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多版本开发吧
【Mac 上安装 pyenv 使用多版本python开发项目】
推荐阅读
- 赫舍里和容妃 历史上的珍妃
- 市场上最贵的淡水鱼有哪些?
- 历史上永琪的母亲怎么死的 历史上的永琪的女儿
- 存储卡|读取最快95MB/s:创见推出MacBook Pro定制存储卡
- 历史上和珅真的那么贪吗 和珅为什么不跑
- 猴菇丁香茶的功效,茶王赛上赛茶王
- 喝什么茶可以去黑眼圈,上火了喝什么茶
- 八 历史上真实的魏忠贤,其实是这样的(历史上有魏忠贤这个人吗)
- 中国历史上武力最强的皇帝 中国皇帝军事能力排名
- 吴用和谁在宋江坟前上吊 最后在宋江墓前自缢身亡的是