当我在mac上安装了python 3.5时终端运行python 2.7.

Joo*_*. P 1 python macos python-2.7 python-3.5

我在我的mac上安装,卸载和重新安装pythons,我认为事情搞砸了一点.

默认情况下,终端在键入时运行Python 3.5

$python
Run Code Online (Sandbox Code Playgroud)

,但在做了一些事情后,它安装了2.7,现在终端运行python 2.7而不是3.5

我安装了python 3.5表格http://python.org/.

当我打开bash_profile时

$vim ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)

这就是出现的情况

# virtualenv
export WORKON_HOME=~/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh


# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
Run Code Online (Sandbox Code Playgroud)

现在当我输入:

$ python
Run Code Online (Sandbox Code Playgroud)

这显示:

Python 2.7.11 (default, Jun 23 2016, 17:25:20) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Run Code Online (Sandbox Code Playgroud)

如何重置所有python的东西(删除旧版本等)到我第一次购买Mac(python3.5)时的工厂版本?

小智 7

这对我有用:

Python 3.x

python3
Run Code Online (Sandbox Code Playgroud)

Python 2.x

python
Run Code Online (Sandbox Code Playgroud)

在终端