问题
(macbook air)
I spent a while trying to install this. First off, I can't use Homebrew because I installed it but then the 'network connection' dropped and now my computer can't find the 'brew' command, but it says homebrew in installed. So I don't know how to uninstall it without using the brew command.
So I am trying to install numpy from the command line. I have xcode, command line tools, gcc fortran 4.2.3, and downloaded numpy. I am getting a RuntimeError when trying to install it! I've read and tried everything from previous posts.
I have attached my Path to show you all, maybe I messed that up?
echo $PATH
/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/3.4 bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Would love your help!!
Traceback (most recent call last):
File "setup.py", line 251, in <module>
setup_package()
File "setup.py", line 243, in setup_package
setup(**metadata)
File "/Users/Anisa/Downloads/numpy-1.9.1/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Anisa/Downloads/numpy-1.9.1/numpy/distutils/command/build.py", line 39, in run
old_build.run(self)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/build.py", line 134, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Anisa/Downloads/numpy-1.9.1/numpy/distutils/command/build_src.py", line 153, in run
self.build_sources()
File "/Users/Anisa/Downloads/numpy-1.9.1/numpy/distutils/command/build_src.py", line 164, in build_sources
self.build_library_sources(*libname_info)
File "/Users/Anisa/Downloads/numpy-1.9.1/numpy/distutils/command/build_src.py", line 299, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "/Users/Anisa/Downloads/numpy-1.9.1/numpy/distutils/command/build_src.py", line 386, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 686, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
回答1:
I ran into this issue twice, and both times I fixed it this way: abandoning pip.
First time was on osx I did brew install numpy. Homebrew will take care of all of the dependencies.
Second time was on centos7 and much like above I just yum install -y numpy.
回答2:
I'm having this same problem (only I'm using brew install numpy), with:
File "numpy/core/setup.py", line 686, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
(Here is a full gist-log of my error.)
This question has some potential solutions: Problems with pip install numpy - RuntimeError: Broken toolchain: cannot link a simple C program.
Though I don't want to resort to sudo, and I want to stick with homebrew (because I'm really aiming for a homebrewed opencv), so I've had no luck so far.
Edit: adding export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future to my .bash_profile (as was suggested in the other question I linked) let brew install numpy almost flawlessly. All that remained after was that I had to brew link --overwrite numpy (because I had a non-brew installation of numpy before). Seems to be working now.
回答3:
I had a similar issue with Python3 numpy install in Fedora 24
Solution provided here by Ollegn that worked for me was:
sudo dnf install python3-devel
sudo dnf install make automake gcc gcc-c++ gcc-gfortran
sudo dnf install redhat-rpm-config
sudo dnf install subversion
sudo pip3 install -U numpy
来源:https://stackoverflow.com/questions/27751996/numpy-install-runtimeerror-broken-toolchain-cannot-link-a-simple-c-program