在 Mac OS X Yosemite 上安装 Python3
Installing Python3 on Mac OS X Yosemite
我正在尝试在 Mac OS X Yosemite 上安装 Python3,并通过 运行 执行以下命令:
$ brew install python3
当我尝试这样做时,出现以下错误:
clang: error: unable to find utility "clang", not a developer tool or in PATH
otool: error: unable to find utility "otool", not a developer tool or in PATH
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
我该如何解决这个问题?
谢谢。
我强烈推荐使用 anaconda distribution, in particular miniconda。
对于 OSX Yosemite,这是 link 到 Python 3.4 64-bit installer。
下载应用程序后,打开终端 window,导航到您下载应用程序的位置(例如 cd ~/Downloads)并输入:
bash Miniconda-latest-MacOSX-x86_64.sh
现在关闭并重新打开您的终端window以使更改生效。
要测试您的安装,请从终端输入命令 conda list
。如果安装正确,您将看到已安装的软件包列表。
从这里开始,您应该可以按照屏幕上的说明进行操作。如果迷路了,可以参考他们的installation guide.
conda安装完成后,需要创建环境。使用 Python 3:
安装名为 py3
的新环境
conda create --name py3 python=3
要激活此环境:
source activate py3
这里我一般安装iPython,iPythonnotebook和pyqt:
conda install ipython, ipython-notebook, pyqt
现在,要从您的环境中激活 ipython shell:
ipython qtconsole
尽管此回复并未尝试修复自制程序问题,但它回答了如何在 Mac OS X Yosemite 上安装 Python3 的问题。
先尝试 brew update
,然后再尝试 brew doctor
。医生诊断常见问题。
您的 Xcode/Command 线条工具似乎有问题。 回答可能会有帮助。
打开终端并
[尝试]: brew update
[或 Homebrew 安装]:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(代码源位于 https://brew.sh/)
确保进程完成,然后 [重试]: brew install python3
对我来说,我运行brew doctor
说
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
pandoc
heroku
numpy
unbound
python@3.8
所以我运行brew link python@3.8
紧接着,python3
突然起作用了!
我正在尝试在 Mac OS X Yosemite 上安装 Python3,并通过 运行 执行以下命令:
$ brew install python3
当我尝试这样做时,出现以下错误:
clang: error: unable to find utility "clang", not a developer tool or in PATH
otool: error: unable to find utility "otool", not a developer tool or in PATH
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
我该如何解决这个问题?
谢谢。
我强烈推荐使用 anaconda distribution, in particular miniconda。
对于 OSX Yosemite,这是 link 到 Python 3.4 64-bit installer。
下载应用程序后,打开终端 window,导航到您下载应用程序的位置(例如 cd ~/Downloads)并输入:
bash Miniconda-latest-MacOSX-x86_64.sh
现在关闭并重新打开您的终端window以使更改生效。
要测试您的安装,请从终端输入命令 conda list
。如果安装正确,您将看到已安装的软件包列表。
从这里开始,您应该可以按照屏幕上的说明进行操作。如果迷路了,可以参考他们的installation guide.
conda安装完成后,需要创建环境。使用 Python 3:
安装名为py3
的新环境
conda create --name py3 python=3
要激活此环境:
source activate py3
这里我一般安装iPython,iPythonnotebook和pyqt:
conda install ipython, ipython-notebook, pyqt
现在,要从您的环境中激活 ipython shell:
ipython qtconsole
尽管此回复并未尝试修复自制程序问题,但它回答了如何在 Mac OS X Yosemite 上安装 Python3 的问题。
先尝试 brew update
,然后再尝试 brew doctor
。医生诊断常见问题。
您的 Xcode/Command 线条工具似乎有问题。
打开终端并
[尝试]: brew update
[或 Homebrew 安装]:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(代码源位于 https://brew.sh/)
确保进程完成,然后 [重试]: brew install python3
对我来说,我运行brew doctor
说
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
pandoc
heroku
numpy
unbound
python@3.8
所以我运行brew link python@3.8
紧接着,python3
突然起作用了!