【问题标题】:Install pyCurl in ActivePython-2.6?在 ActivePython-2.6 中安装 pyCurl?
【发布时间】:2009-06-25 19:57:17
【问题描述】:

我过去曾使用过 pyCurl,并让它与我的系统默认 python 安装一起使用。但是,我有一个项目需要 python 更便携,我正在使用 ActivePython-2.6。

到目前为止,我在安装任何其他模块时都没有遇到任何问题,但是在安装 pyCurl 时遇到了错误。 错误:

Searching for pycurl
Reading http://pypi.python.org/simple/pycurl/
Reading http://pycurl.sourceforge.net/
Reading http://pycurl.sourceforge.net/download/
Best match: pycurl 7.19.0
Downloading http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz
Processing pycurl-7.19.0.tar.gz
Running pycurl-7.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-tfVLW6/pycurl-7.19.0/egg-dist-tmp-p1WjAy
sh: curl-config: not found
Traceback (most recent call last):
  File "/opt/ActivePython-2.6/bin/easy_install", line 8, in <module>
    load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 1671, in main
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 1659, in with_ei_usage
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 1675, in <lambda>
  File "/opt/ActivePython-2.6/lib/python2.6/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/opt/ActivePython-2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "/opt/ActivePython-2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 211, in run
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 476, in install_item
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 655, in install_eggs
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 930, in build_and_install
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 919, in run_setup
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/sandbox.py", line 27, in run_setup
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/sandbox.py", line 63, in run
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/sandbox.py", line 29, in <lambda>
  File "setup.py", line 90, in <module>
Exception: `curl-config' not found -- please install the libcurl development files

我的系统确实安装了 libcurl,但 ActivePython 似乎没有找到它。

任何想法都会有所帮助!

【问题讨论】:

    标签: python libcurl pycurl activepython


    【解决方案1】:

    安装pycurl需要以下依赖:

    apt-cache depends python-pycurl
    python-pycurl
     Depends: libc6
    Depends: libcurl3-gnutls
    Depends: libgcrypt11
    Depends: python2.7
    Depends: python
    Depends: python
    Suggests: libcurl4-gnutls-dev
    Suggests: python-pycurl-dbg
    Conflicts: <python2.3-pycurl>
    Conflicts: <python2.3-pycurl:i386>
    Conflicts: <python2.4-pycurl>
    Conflicts: <python2.4-pycurl:i386>
    Replaces: <python2.3-pycurl>
    Replaces: <python2.3-pycurl:i386>
    Replaces: <python2.4-pycurl>
    Replaces: <python2.4-pycurl:i386>
    Conflicts: python-pycurl:i386
    

    运行这个命令

    sudo apt-get install libcurl4-gnutls-dev librtmp-dev
    

    然后你可以使用 pycurl 安装

    pip install pycurl
    

    easy_install pycurl
    

    【讨论】:

      【解决方案2】:

      我找不到要添加到路径的 curl-config,这是有道理的,因为它不是可以调用的模块(据我所知)

      答案最终有点像黑客,但它确实有效。

      由于我在本机 python2.6 安装中使用了 pyCurl,我只是将 curl 和 pycurl 项从本机安装复制到 ActivePython 安装中。

      【讨论】:

        【解决方案3】:
        $ apt-cache depends python-pycurl
        python-pycurl
          Depends: libc6
          Depends: libcurl3-gnutls
          Depends: libgnutls26
          Depends: libidn11
          Depends: libkrb53
          Depends: libldap-2.4-2
          Depends: zlib1g
          Depends: python
          Depends: python
          Depends: python-central
        [...]
        

        所以首先通过sudo aptitude install libcurl3-gnutls(或您的发行版的包管理器)安装依赖项,然后运行easy_install pycurl

        【讨论】:

        • sudo apt-get install libcurl4-gnutls-dev python-pycurl-dbg librtmp-dev 是为我做的
        【解决方案4】:

        看起来curl-config 不在您的路径中。尝试从命令行运行它并根据需要调整 PATH 环境变量,以便 Python 可以找到它。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2016-05-22
          • 1970-01-01
          • 2011-08-06
          • 2011-02-10
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多