我真的需要在我的Mac上使用pycurl。
我在Mac上运行python代码时遇到了很多麻烦,主要是因为我几乎没有任何库可以使用。例如,如果我输入
import pycurl
给我错误:
ImportError:没有名为pycurl的模块
好的很酷,所以让我们用pycurl-7.19.3安装pycurl:
Matts-MacBook-Pro:pycurl-7.19.3 CiniCraft$ python setup.py install
Using curl-config (libcurl 7.21.4)
running install
running build
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 487, in <module>
setup(**setup_args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 563, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 307, in run
customize_compiler(self.compiler)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/sysconfig.py", line 170, in customize_compiler
_osx_support.customize_compiler(_config_vars)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_osx_support.py", line 418, in customize_compiler
_find_appropriate_compiler(_config_vars)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_osx_support.py", line 191, in _find_appropriate_compiler
"Cannot locate working compiler")
SystemError: Cannot locate working compiler
当然,这也不起作用,所以让easy_install它:
sudo easy_install pycurl
Searching for pycurl
Reading http://pypi.python.org/simple/pycurl/
Best match: pycurl 7.19.3
Downloading https://pypi.python.org/packages/source/p/pycurl/pycurl-7.19.3.tar.gz#md5=b9091b7438d3de1552e28862d2971cd1
Processing pycurl-7.19.3.tar.gz
Running pycurl-7.19.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-d16j45/pycurl-7.19.3/egg-dist-tmp-6PRcV6
Using curl-config (libcurl 7.21.4)
unable to execute llvm-gcc-4.2: No such file or directory
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
我认为此时我已尝试过所有内容......我正在为OS X 10.7.3下载Xcode 4.2.1的旧版本
Xcode是否应该添加我需要的所有python库并希望解决我的大多数问题?
答案 0 :(得分:0)
然后继续安装pycurl