Python 如何解决ImportError“No module named pycurl”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28958563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 03:56:38  来源:igfitidea点击:

How to resolve ImportError "No module named pycurl"

pythondjangopython-2.7

提问by Atul Thakre

I want to use grab api in my coding.i have install 2.7 python and django framwork.i have also install grab-0.5.4 api in my system. here is my code:

我想在我的编码中使用抓取 api。我已经安装了 2.7 python 和 django 框架。我还在我的系统中安装了抓取 0.5.4 api。这是我的代码:

def getGrab(request):
    g = Grab()
    g.go('https://github.com/login')
    g.set_input('login', 'lorien')
    g.set_input('password', '***')
    g.submit()
    for elem in g.doc.select('//ul[@id="repo_listing"]/li/a'):
        print '%s: %s' % (elem.text(), elem.attr('href'))
    return "yes"

I want to call from view.py file. how to resloved this error:

我想从 view.py 文件中调用。如何重新解决此错误:

ImportError at /getGrab

No module named pycurl

Request Method:     GET
Request URL:    http://localhost:8000/getGrab
Django Version:     1.7.3
Exception Type:     ImportError
Exception Value:    

No module named pycurl

Exception Location:     C:\Python27\lib\site-packages\grab-0.5.4-py2.7.egg\grab\transport\curl.py in <module>, line 17
Python Executable:  C:\Python27\python.exe
Python Version:     2.7.3
Python Path:    

['E:\twitterproject',
 'C:\Python27\lib\site-packages\setuptools-12.0.5-py2.7.egg',
 'C:\Python27\lib\site-packages\django-1.7.3-py2.7.egg',
 'C:\Python27\lib\site-packages\requests-2.5.1-py2.7.egg',
 'C:\Python27\lib\site-packages\grab-0.5.4-py2.7.egg',
 'C:\WINDOWS\SYSTEM32\python27.zip',
 'C:\Python27\DLLs',
 'C:\Python27\lib',
 'C:\Python27\lib\plat-win',
 'C:\Python27\lib\lib-tk',
 'C:\Python27',
 'C:\Python27\lib\site-packages']

Here we need to install pycurl? if yes please let me know how to install pycurl or any thing else need to install?

这里需要安装pycurl吗?如果是,请让我知道如何安装 pycurl 或其他任何需要安装的东西?

thanks

谢谢

回答by Michael Vietluzhskih

1) Open the cmd.exe

1)打开cmd.exe

2) Run pip install pycurl

2)运行 pip install pycurl

Now it must work

现在它必须工作

回答by Kostyantyn

Had the same issue with python3.5 on ubuntu 14.04 when checking pydocusign version:

检查 pydocusign 版本时,ubuntu 14.04 上的 python3.5 有同样的问题:

python -c "import pydocusign;print(pydocusign.__version__)"

The @Michael Vietluzhskih didn't help, but the command below did:

@Michael Vietluzhskih 没有帮助,但下面的命令做了:

pip -v install pycurl --upgrade