问题
i'm trying to install PyCrypto for Python 3.4 but i'm having problem with the C compiled programs. it says that "error: cannot run C compiled program". anyone have an idea how to fix it??
code:
running build
running build_py
running build_ext
running build_configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/briansabbath/Desktop/pycrypto-2.6.1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Traceback (most recent call last):
File "setup.py", line 456, in <module>
core.setup(**kw)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/command/build.py", line 126, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 251, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error
回答1:
This might indicate that you did not install C compiler likes gcc. Run the following command might help (command line tool must be installed in xcode):
xcode-select --install
回答2:
The method that worked for me
brew install pip
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pycrypto
You can run it in a virtualenv. If you have a better way please leave a comment below!
来源:https://stackoverflow.com/questions/27630793/error-installing-pycrypto-on-mac-10-9-5