2

I'm trying to install Python3 on a Mac OS X Yosemite, and did that by running the following command:

$ brew install python3

When I tried that, I got the following error:

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

How can I fix this issue?

Thanks.

Thomas Lee
  • 1,312
  • 8
  • 17
Simplicity
  • 47,404
  • 98
  • 256
  • 385

4 Answers4

3

I would highly recommend using the anaconda distribution, in particular miniconda.

For OSX Yosemite, this is a link to the Python 3.4 64-bit installer.

After downloading the application, open a terminal window, navigate to where you downloaded the app (e.g. cd ~/Downloads) and type:

bash Miniconda-latest-MacOSX-x86_64.sh

Now close and re-open your terminal window for the changes to take effect.

To test your installation, enter the command conda list from the terminal. If installed correctly, you will see a list of packages that were installed.

From here, you should be able to follow the on-screen instructions. If you get lost, you can refer to their installation guide.

After installing conda, you need to create an environment. To install an new environment named py3 with Python 3:

conda create --name py3 python=3

To activate this environment:

source activate py3

Here, I normally install iPython, iPython notebook and pyqt:

conda install ipython, ipython-notebook, pyqt

Now, to activate an ipython shell from within your environment:

ipython qtconsole

Although this reply does not attempt fix the homebrew issue, it answers the question of how to install Python3 on Mac OS X Yosemite.

Alexander
  • 105,104
  • 32
  • 201
  • 196
  • Thanks for your reply. I followed the instructions, but, when I type $ python --version, I get: python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No such file or directory – Simplicity Aug 27 '15 at 12:40
  • Try `python3 --version`. You can also check the location of the binary with `which python` or `which python3`. I've expanded my reply above. Note that you generally work in python from the environment you create. This is to prevent inadvertently damaging your system installation. – Alexander Aug 27 '15 at 16:31
3

Try brew update and then brew doctor first. The doctor diagnoses common issues.

Seems something's wrong with your Xcode/Command Line Tools. This answer might be helpful.

Community
  • 1
  • 1
Thomas Lee
  • 1,312
  • 8
  • 17
0

Open Terminal and
[Try]: brew update
[or Homebrew Install]: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(code source found at https://brew.sh/)
Make sure processes finish, and then [Re-Try]: brew install python3

0

For me, I ran brew doctor which said

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

So I ran brew link python@3.8

And immediately after, python3 suddenly works!

stevec
  • 41,291
  • 27
  • 223
  • 311