PyCurl installiert, aber nicht gefunden
Ich versucht habe zu installieren pycurl in einem virtualenv mit easy_install, und es scheint korrekt installiert werden:
(xxx) $ easy_install 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-B2W9dY/pycurl-7.19.0/egg-dist-tmp-RmIsVr
Using curl-config (libcurl 7.19.7)
src/pycurl.c:85:4: warning: #warning "libcurl was compiled with SSL support, but configure could not determine which " "library was used; thus no SSL crypto locking callbacks will be set, which may " "cause random crashes on SSL requests"
src/pycurl.c: In function ‘do_multi_info_read’:
src/pycurl.c:2843: warning: call to ‘_curl_easy_getinfo_err_string’ declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info
src/pycurl.c: In function ‘multi_socket_callback’:
src/pycurl.c:2355: warning: call to ‘_curl_easy_getinfo_err_string’ declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info
In function ‘util_curl_unsetopt’,
inlined from ‘do_curl_unsetopt’ at src/pycurl.c:1551:
src/pycurl.c:1476: warning: call to ‘_curl_easy_setopt_err_CURLSH’ declared with attribute warning: curl_easy_setopt expects a CURLSH* argument for this option
gcc (GCC) 4.4.4 20100726 (Red Hat 4.4.4-13)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
zip_safe flag not set; analyzing archive contents...
Adding pycurl 7.19.0 to easy-install.pth file
Installed /home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/pycurl-7.19.0-py2.7-linux-x86_64.egg
Processing dependencies for pycurl
Finished processing dependencies for pycurl
Jedoch, wenn Sie versuchen, zu verwenden, bekomme ich die folgende Fehlermeldung:
(xxx) $ python
Python 2.7.1 (r271:86832, Sep 12 2011, 13:51:42)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycurl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pycurl
Trotz der Tatsache, dass ich kann deutlich sehen, ein pycurl-7.19.0-py2.7-linux-x86_64.egg
in meinem ~/.virtualenvs/xxx/lib/python2.7/site-packages
Verzeichnis.
Irgendwelche Vorschläge, wie dieses problem zu lösen wäre sehr geschätzt werden!
Distribution ist Amazon Linux (EC2, 64 bit), Python 2.7, aus dem Quellcode installiert. curl, libcurl und libcurl-dev sind alle geliefert von Amazon yum repos und sind in der version 7.19.7-26.20.
Kann ich nicht installieren pycurl Paket, bereitgestellt durch der Amazon-repos, weil die Distribution gelieferte version von python 2.6, und mein Projekt läuft auf 2.7.
Es ist nicht ein Pfad Problem, den Inhalt von sys.Pfad ist wie folgt:
>>> import sys; sys.path
['', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/pygeoip-0.2.1-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/daryl_lib-1.8.4-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/xxx-1.8.4-py2.7.egg', '/home/ec2-user/dealutils-1.5.0-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/six-1.0.0-py2.7.egg', '/home/ec2-user/fm2c-1.3.0-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/affiliatewindow-1.3.0-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/icodes-1.3.0-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/meld3-0.6.7-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/tornado-1.2-py2.7.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/pycurl-7.19.0-py2.7-linux-x86_64.egg', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages', '/root', '/home/ec2-user/.virtualenvs/xxx/lib/python27.zip', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/plat-linux2', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/lib-tk', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/lib-old', '/home/ec2-user/.virtualenvs/xxx/lib/python2.7/lib-dynload', '/opt/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/opt/python2.7/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg', '/opt/python2.7/lib/python2.7', '/opt/python2.7/lib/python2.7/plat-linux2', '/opt/python2.7/lib/python2.7/lib-tk', '/opt/python2.7/lib/python2.7/site-packages']
Tomasso: Hinzugefügt sys.Pfad Ausgabe wichtigste Frage seit im Kommentarfeld ist zu kurz. Es ist nicht ein Pfad-Problem. Irgendwelche anderen Vorschläge?
InformationsquelleAutor majackson | 2011-09-12
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ich habe es geschafft (mit etwas Hilfe), damit das problem zu lösen. Das problem ist, dass nach der installation, die pycurl.so wird nicht kopiert, auf die Website-Pakete für das virtualenv.
Beim installieren über
pip -v install pycurl
folgende Ausgabe erhalten:Den Schlüssel Fehler ist hier:
gcc -pthread -shared build/temp.linux-x86_64-2.7/src/pycurl.o -L/opt/python2.7/lib -lcurl -lpython2.7 -o build/lib.linux-x86_64-2.7/pycurl.so unknown option: --static-libs Usage: curl-config [OPTION] Available values for OPTION include: --ca ca bundle install path --cc compiler --cflags pre-processor and compiler flags --checkfor [version] check for (lib)curl of the specified version --features newline separated list of enabled features --help display this help and exit --libs library linking information --prefix curl install prefix --protocols newline separated list of enabled protocols --version output version information --vernum output the version information as a number (hexadecimal)
Was zeigt, dass
curl-config
genannt wird, mit dem argument--static-libs
, die es nicht erkennen und stattdessen druckt er die "Anwendung" ausgegeben. Am wichtigsten ist, es ist die Rückkehr einer nicht-Fehler-code ausgegeben wird, die macht der compiler davon ausgehen, daspycurl.so
Kompilierung erfolgreich war.Dies ist im detail beschrieben hier
Die Lösung für dieses problem war es, ändern Sie die pycurl ist setup.py und ändern Sie Zeile 101 zu Lesen
--libs
statt--static-libs
. Dies bewirkt, dasspycurl.so
gebaut werden und kopiert Sie in densite-packages
Verzeichnis erfolgreich.InformationsquelleAutor majackson
Ein update für das Jahr 2015 zu diesem Thema.
Ich lief in dieser Installation Pycurl auf einem Mac mit Yosemite. I changed line 150 in
setup.py
wie unten gezeigt::
Dann ran:
Installation funktionierte perfekt danach!
InformationsquelleAutor William Smith