mac上Python多版本共存(python2.7.10和python3.5.0)
本文的实现目标是在mac上安装一个python3.5.0的版本,跟当前系统自带的python2.7.10共存.
查看当前版本号
python -V
2.7.10
安装配置Python版本管理器pyenv
1. 安装pyenv
brew install pyenv
安装过程中,遇到一个一个问题Error: parent directory is world writable but not sticky
2. 根据提示需要添加变量
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
export PYENV_ROOT=/usr/local/var/pyenv
因为我已经安装了zsh,所以需要在~/.zshrc中将上面的两句加入到文件的末尾,最后执行
source ~/.zshrc
3. 查看已经安装了哪些版本的Python
pyenv versions
其中版本号前面有*号的就是当前生效的版本,查看当前生效的版本也可以用
pyenv version
4. 安装指定版本的Python
pyenv install 3.5.0
#安装完成后必须rehash
pyenv rehash
安装过程中,也是出现报错BUILD FAILED (OS X 10.10.5 using python-build 20160130),解决办法见pyenv BUILD FAILED解决方法
5. 切换和使用指定的版本Python版本有3种方法
➜ ~ pyenv
pyenv 20150310
Usage: pyenv <command> [<args>]
Some useful pyenv commands are:
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
See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/yyuu/pyenv#readme
特别建议:
系统全局用系统默认的Python比较好,不建议直接对其操作
pyenv global system
用local进行指定版本切换,一般开发环境使用。
pyenv local 2.7.10
对当前用户的临时设定Python版本,退出后失效
pyenv shell 3.5.0
取消某版本切换
pyenv local 3.5.0 --unset
优先级关系:shell——local——global
#####另外最重要的一点,当执行了pyenv shell/local/global 命令后,一定要执行 source ~/.zshrc ,不然切换版本就不会生效。
最后执行
➜ ~ pyenv versions
system
* 3.5.0 (set by PYENV_VERSION environment variable)
➜ ~
➜ ~ python -V
Python 3.5.0
参考资料:
Mac多Python版本共存,多个独立Python开发环境切换
mac上Python多版本共存(python2.7.10和python3.5.0)的更多相关文章
- mac上Python多版本共存
http://www.cnblogs.com/mingaixin/p/6295963.html https://www.cnhzz.com/pyenv_virtualenv_virtaulenvwra ...
- Mac 上Python多版本切换
Mac上自带了Python2.x的版本,有时需要使用Python3.x版本做开发,但不能删了Python2.x,可能引起系统不稳定,那么就需要安装多个版本的Python. 1.安装Python3.x版 ...
- 在Mac上Python多版本切换
1.安装Homebrewhttps://brew.sh/index_zh-cn.html 2.通过brew安装pyenv1)命令行输入:$ brew install pyenv(如果一直卡在Updat ...
- Linux系统中python默认版本为python2.7,修改为python3 项目上传码云
# 查询系统本系统中安装的python版本 ls -l /usr/bin/python* 1.在虚拟机上新建虚拟环境 # 系统中python默认版本为python2.,可以将其修改为python3 # ...
- [转]Windows下Python多版本共存
https://blog.csdn.net/dream_an/article/details/51248736 Windows下Python多版本共存 Python数据科学安装Numby,pandas ...
- windows配置Python多版本共存
windows配置Python多版本共存 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 最近Python开发蛮火的,三年前我的一个运维朋友就告诉我说Python语言将来会很火,当时 ...
- Windows下Python多版本共存
Windows下Python多版本共存 Python数据科学安装Numby,pandas,scipy,matpotlib等(IPython安装pandas) 0.0 因为公司项目,需要Python两个 ...
- Python多版本共存安装
Python的安装 进入Python官方网站:www.python.org下载系统对应的Python版本 按照提示步奏安装,安装路径选择自定义,方便查找 安装完成后,按win+R键,输入cmd进入cm ...
- Ancoda 下的python多版本共存
Ancoda 下的python多版本共存 virtualenv python 多版本共存 Pip, Virtualenv 和Fabric 被称为python 的三大神器,Pip 是包管理工具,Virt ...
随机推荐
- VB 获取文件版本
Function GetVer(FilePathName As String) As String If FilePathName = Nothing Or FilePathName = " ...
- WinForm中DataGridView导出为Excel(快速版)
public static void ExportExcel(DataGridView myDGV, string fileName) { string saveFileName = fileName ...
- TVTK库的安装
1.在网址为:http://www.lfd.uci.edu/~gohlke/pythonlibs/ 里下载以下内容: VTK-7.1.1-cp36-cp36m-win_amd64.whlnumpy-1 ...
- windows下配置 GNU的gdb调试功能
1.配置 修改环境变量(前提电脑中存在gdb.exe) 1. 我的电脑->属性->环境......在path那一项后面添加你DEV-C++ Bin目录的路径(gdb.exe所在目录),如: ...
- Redis集群方案总结
Redis集群方案总结 Redis集群方案总结Codis其余方案Redis cluster 目前,Redis中目前集群有以下几种方案: 主从复制 哨兵模式 redis cluster 代理 codis ...
- Linux学习笔记10—Linux下chkconfig命令详解
chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接. 使用语法: chkconfig [--a ...
- history.pushState无刷新改变url
通过history.pushState无刷新改变url 背景 在浏览器中改变地址栏url,将会触发页面资源的重新加载,这使得我们可以在不同的页面间进行跳转,得以浏览不同的内容.但随着单页应用的增多,越 ...
- Mui 下拉刷新,刷新完成功能实现
Mui中,正在刷新后,就直接回弹了,没有刷新完成这个过程,然后我就在中间添加了一个过程. 代码如下: //-----------日期格式化------------- function form ...
- [C#]手把手教你打造Socket的TCP通讯连接(一)
本文章将讲解基于TCP连接的Socket通讯,使用Socket异步功能,并且无粘包现象,通过事件驱动使用. 在编写Socket代码之前,我们得要定义一下Socket的基本功能. 作为一个TCP连接,不 ...
- WPF背景图
方法一:xaml中:<控件> <控件.Background><ImageBrush ImageSource="/程序集;component/images/xx ...