2011-09-12 13 views
12

मैं easy_install के साथ एक virtualenv में pycurl स्थापित करने का प्रयास किया गया है नहीं मिला है, और इसे सही ढंग से स्थापित करने के लिए प्रकट होता है:PyCurl स्थापित लेकिन

(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 

हालांकि, जब उपयोग करने के लिए कोशिश कर रहा है, मैं निम्नलिखित त्रुटि मिलती है:

(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 
तथ्य यह है कि मैं स्पष्ट रूप से मेरे ~/.virtualenvs/xxx/lib/python2.7/site-packages निर्देशिका में pycurl-7.19.0-py2.7-linux-x86_64.egg देख सकते हैं के बावजूद

इस समस्या को हल करने के तरीके पर कोई सुझाव बहुत सराहना की जाएगी!

वितरण अमेज़ॅन लिनक्स (ईसी 2, 64 बिट) है, पायथन 2.7 है, स्रोत से स्थापित है। कर्ल, libcurl और libcurl-dev सभी अमेज़ॅन यम repos द्वारा आपूर्ति कर रहे हैं और संस्करण 7.19.7-26.20 पर हैं।

मैं अमेज़ॅन रिपोज द्वारा प्रदान किए गए pycurl पैकेज को स्थापित नहीं कर सकता क्योंकि पाइथन का डिस्ट्रो-आपूर्ति संस्करण 2.6 है, और मेरी परियोजना 2.7 पर चलती है।

>>> 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'] 
+0

sys.path से आप क्या प्राप्त करते हैं? –

+0

टॉमसो: जोड़ा sys।मुख्य प्रश्न के लिए पथ आउटपुट क्योंकि टिप्पणी बॉक्स बहुत छोटा है। यह एक पथ मुद्दा नहीं है। कोई अन्य सुझाव? – majackson

उत्तर

23

मैं कामयाब रहे (कुछ मदद के साथ) तो समस्या का समाधान:

यह एक पथ मुद्दा नहीं है, sys.path की सामग्री को इस प्रकार है। समस्या यह है कि स्थापना के बाद, pycurl.so इस वर्चुअलएनवी के लिए साइट-पैकेज में कॉपी नहीं किया गया है।

जब pip -v install pycurl के माध्यम से स्थापित करने के लिए, निम्न उत्पादन दिया जाता है:

Downloading/unpacking pycurl 
    Using version 7.19.0 (newest of versions: 7.19.0, 7.19.0, 7.18.2, 7.18.1, 7.16.4, 7.16.2.1, 7.16.2, 7.16.1, 7.15.5.1) 
    Downloading pycurl-7.19.0.tar.gz (71Kb): 71Kb downloaded 
    Running setup.py egg_info for package pycurl 
     Using curl-config (libcurl 7.19.7) 
    running egg_info 
    creating pip-egg-info/pycurl.egg-info 
    writing pip-egg-info/pycurl.egg-info/PKG-INFO 
    writing top-level names to pip-egg-info/pycurl.egg-info/top_level.txt 
    writing dependency_links to pip-egg-info/pycurl.egg-info/dependency_links.txt 
    writing manifest file 'pip-egg-info/pycurl.egg-info/SOURCES.txt' 
    warning: manifest_maker: standard file '-c' not found 

    reading manifest file 'pip-egg-info/pycurl.egg-info/SOURCES.txt' 
    reading manifest template 'MANIFEST.in' 
    writing manifest file 'pip-egg-info/pycurl.egg-info/SOURCES.txt' 
Installing collected packages: pycurl 
    Running setup.py install for pycurl 
    Using curl-config (libcurl 7.19.7) 
    running install 
    running build 
    running build_py 
    creating build 
    creating build/lib.linux-x86_64-2.7 
    creating build/lib.linux-x86_64-2.7/curl 
    copying python/curl/__init__.py -> build/lib.linux-x86_64-2.7/curl 
    running build_ext 
    building 'pycurl' extension 
    creating build/temp.linux-x86_64-2.7 
    creating build/temp.linux-x86_64-2.7/src 
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_CURL_SSL=1 -I/opt/python2.7/include/python2.7 -c src/pycurl.c -o build/temp.linux-x86_64-2.7/src/pycurl.o 
    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 -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) 
    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. 

    running install_lib 
    creating /home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/curl 
    copying build/lib.linux-x86_64-2.7/curl/__init__.py -> /home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/curl 
    byte-compiling /home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/curl/__init__.py to __init__.pyc 
    running install_data 
    copying ChangeLog -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl 
    copying COPYING -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl 
    copying COPYING2 -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl 
    copying INSTALL -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl 
    copying README -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl 
    copying TODO -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl 
    copying doc/curlshareobject.html -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/html 
    copying doc/pycurl.html -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/html 
    copying doc/curlobject.html -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/html 
    copying doc/curlmultiobject.html -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/html 
    copying doc/callbacks.html -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/html 
    copying examples/retriever.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/examples 
    copying examples/file_upload.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/examples 
    copying examples/linksys.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/examples 
    copying examples/xmlrpc_curl.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/examples 
    copying examples/retriever-multi.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/examples 
    copying examples/sfquery.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/examples 
    copying examples/basicfirst.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/examples 
    copying tests/test.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_ftp.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_share.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi5.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi_timer.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_post.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_gtk.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_post3.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_debug.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi4.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_cb.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi_vs_thread.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_stringio.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_xmlrpc.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi_socket_select.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi6.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi_socket.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/util.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi3.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_internals.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_post2.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_memleak.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_multi2.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_socketopen.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    copying tests/test_getinfo.py -> /home/ec2-user/.virtualenvs/xxx/share/doc/pycurl/tests 
    running install_egg_info 
    running egg_info 
    creating pycurl.egg-info 
    writing pycurl.egg-info/PKG-INFO 
    writing top-level names to pycurl.egg-info/top_level.txt 
    writing dependency_links to pycurl.egg-info/dependency_links.txt 
    writing manifest file 'pycurl.egg-info/SOURCES.txt' 
    warning: manifest_maker: standard file '-c' not found 

    reading manifest file 'pycurl.egg-info/SOURCES.txt' 
    reading manifest template 'MANIFEST.in' 
    writing manifest file 'pycurl.egg-info/SOURCES.txt' 
    Copying pycurl.egg-info to /home/ec2-user/.virtualenvs/xxx/lib/python2.7/site-packages/pycurl-7.19.0-py2.7.egg-info 
    running install_scripts 
    writing list of installed files to '/tmp/pip-lEWzoB-record/install-record.txt' 
Successfully installed pycurl 
Cleaning up... 
    Removing temporary dir /home/ec2-user/.virtualenvs/xxx/build... 

कुंजी यहाँ त्रुटि है: 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)

जो दिखाता है कि curl-config तर्क --static-libs है, जो यह करने में विफल रहता साथ बुलाया जा रहा है पहचानें और इसके बजाय इसे 'उपयोग' आउटपुट प्रिंट करें। सबसे महत्वपूर्ण बात यह है कि यह एक गैर-त्रुटि-कोड आउटपुट लौटा रहा है जो संकलक को pycurl.so संकलन सफल बनाता है।

यह और अधिक विस्तार से वर्णन किया गया है here

इस समस्या का समाधान --libs बजाय --static-libs पढ़ने के लिए pycurl के setup.py और परिवर्तन लाइन 101 संशोधित करने के लिए किया गया था। यह pycurl.so का निर्माण और site-packages निर्देशिका में सफलतापूर्वक कॉपी करने का कारण बनता है।

+1

यह सिर्फ मेरे दिन बचाया। मेरे वर्चुअलएन्व में इसे स्थापित करने की कोशिश कर पागल हो रहा है। धन्यवाद! –

1

इस मुद्दे पर 2015 के लिए एक अद्यतन।
मैं इस मैकैमेट चलाने वाले मैक पर इस स्थापित पायकुरल में भाग गया।

for option in ["--libs", "--static-libs"]: 

लिए:

for option in ["--libs"]: 

फिर भाग गया:

$>python setup.py install 

स्थापना के बाद यह पूरी तरह से काम किया है जिन्हें आप नीचे देख रहा setup.py में लाइन बदल गया है!

संबंधित मुद्दे