hi, i'm install pycurl like this:

cd ~
mkdir -p ~/lib/python2.7
mkdir ~/bin ~/tmp ~/src
export TEMP=~/tmp
export PATH=$HOME/bin:$PATH
cd ~/src
wget http://curl.haxx.se/download/curl-7.27.0.tar.bz2
tar xjf curl-7.27.0.tar.bz2
cd curl-7.27.0
./configure --prefix=$HOME
make
make install
easy_install-2.7 pycurl

Finally, you will need to set LD_LIBRARY_PATH to point to the location of your libcurl, eg:

export LD_LIBRARY_PATH=$HOME/lib

when i run shell python2.7 -c "import pycurl" it's ok!

but my apache2 run start ,it's error,"Fatal Python error: pycurl: libcurl link-time version is older than compile-time version"

------------------------------------------------
[Sun Jun 09 01:57:10 2013] [notice] child pid 11069 exit signal Aborted (6)
[Sun Jun 09 01:57:32 2013] [notice] caught SIGTERM, shutting down
[Sun Jun 09 01:57:40 2013] [warn] mod_wsgi: Compiled for Python/2.7.3.
[Sun Jun 09 01:57:40 2013] [warn] mod_wsgi: Runtime using Python/2.7.5.
./pycurl-7.19.0-py2.7-linux-x86_64.egg
n error: pycurl: libcurl link-time version is older than compile-time version
[Sun Jun 09 01:57:40 2013] [notice] Apache/2.2.17 (Unix) mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
Fatal Python error: pycurl: libcurl link-time version is older than compile-time version
[Sun Jun 09 02:00:13 2013] [error] [client 127.0.0.1] Premature end of script headers: wsgi.py
--------------------------------------------------

Please Help Me?

asked 08 Jun '13, 21:18

cbin's gravatar image

cbin
12
accept rate: 0%

edited 08 Jun '13, 22:00

ryans's gravatar image

ryans ♦♦
3.8k1931


When you install pycurl as easy_install-2.7 pycurl, this may not be linking against the same curl which you installed from source (have you confirmed this?). Also, this will install to $HOME/lib, which may not be the same pycurl that your mod_wsgi application is using. Are you sure that sys.path in the application is picking up the new pycurl?

Is this Django? If so, does python2.7 manage.py shell and importing curl differ?

link

answered 08 Jun '13, 23:16

ryans's gravatar image

ryans ♦♦
3.8k1931
accept rate: 44%

edited 08 Jun '13, 23:16

hi, ryans when am i try http://community.webfaction.com/questions/12819/fatal-python-error-pycurl-libcurl-link-time-version-is-older-than-compile-time-version

You need to set the LD_LIBRARY_PATH environment variable for your web application.

Ok, that was what I needed, now it don't shows the error when i import the library.

My code:

#!/bin/bash

LD_LIBRARY_PATH=/home/cbingo/lib /home/cbingo/webapps/analyseo/apache2/lib /home/cbingo/webapps/analyseo/apache2/bin/httpd.worker -f /home/cbingo/webapps/analyseo/apache2/conf/httpd.conf -k start

but report error,

/start: line 3: /home/cbingo/webapps/analyseo/apache2/lib: is a directory
link

answered 09 Jun '13, 00:45

cbin's gravatar image

cbin
12
accept rate: 0%

edited 09 Jun '13, 00:55

ryans's gravatar image

ryans ♦♦
3.8k1931

The LD_LIBRARY_PATH variable is a colon-separated list of directories, so the script should look like this:

#!/bin/bash
LD_LIBRARY_PATH=/home/cbingo/lib:/home/cbingo/webapps/analyseo/apache2/lib /home/cbingo/webapps/analyseo/apache2/bin/httpd.worker -f /home/cbingo/webapps/analyseo/apache2/conf/httpd.conf -k start
(09 Jun '13, 00:56) ryans ♦♦ ryans's gravatar image

can't worked ! Exception Value:

No module named pycurl

see more www.suretoo.com

-------------------------------
ImportError at /

No module named pycurl

Request Method:     GET
Request URL:    http://www.suretoo.com/
Django Version:     1.4.4
Exception Type:     ImportError
Exception Value:

No module named pycurl

Exception Location:     /home/cbingo/webapps/analyseo/analyseo/lib/curl.py in <module>, line 3
Python Executable:  /usr/local/bin/python
Python Version:     2.7.5
Python Path:

['/home/cbingo/webapps/analyseo',
 '/home/cbingo/webapps/analyseo/analyseo',
 '/home/cbingo/webapps/analyseo/lib/python2.7',
 '/home/cbingo/lib/python2.7/python_slugify-0.0.3-py2.7.egg',
 '/home/cbingo/lib/python2.7/Unidecode-0.04.12-py2.7.egg',
 '/home/cbingo/lib/python2.7/pip-1.3.1-py2.7.egg',
 '/home/cbingo/lib/python2.7/pycurl-7.19.0-py2.7-linux-x86_64.egg',
 '/home/cbingo/lib/python2.7',
 '/usr/local/lib/python27.zip',
 '/usr/local/lib/python2.7',
 '/usr/local/lib/python2.7/plat-linux2',
 '/usr/local/lib/python2.7/lib-tk',
 '/usr/local/lib/python2.7/lib-old',
 '/usr/local/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/local/lib/python2.7/site-packages/PIL']

Server time:    ???, 9 ?? 2013 13:59:08 +0800
-------------------------------------------------------
(09 Jun '13, 01:01) cbin cbin's gravatar image

Yes, this is the fundamental problem I addressed in the previous Answer:

Also, this will install to $HOME/lib, which may not be the same pycurl that your mod_wsgi application is using. Are you sure that sys.path in the application is picking up the new pycurl?

(09 Jun '13, 01:10) ryans ♦♦ ryans's gravatar image

this is my django manager.py shell app sys.path

--------------------------------------------------
python2.7 manage.py shell
Python 2.7.5 (default, May 16 2013, 20:16:09)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sys
>>> print(sys.path)
['/home/cbingo/webapps/analyseo/analyseo', '/home/cbingo/webapps/analyseo/lib/python2.7', '/home/cbingo/lib/python2.7/python_slugify-0.0.3-py2.7.egg', '/home/cbingo/lib/python2.7/Unidecode-0.04.12-py2.7.egg', '/home/cbingo/lib/python2.7/pip-1.3.1-py2.7.egg', '/home/cbingo/lib/python2.7/pycurl-7.19.0-py2.7-linux-x86_64.egg', '/home/cbingo/lib/python2.7', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages/PIL']
--------------------------------------------------------

/home/cbingo/lib/python2.7/pycurl-7.19.0-py2.7-linux-x86_64.egg is in the path

(09 Jun '13, 01:43) cbin cbin's gravatar image

I downloaded pycurl-7.19.0-py2.7-linux-x86_64.egg and unzipped it; the module it provides is called curl. You would use:

>>> import curl

This then attempts to import pycurl and requires $HOME/lib/python2.7/pycurl.so.

I tried installing these under a test account and they worked correctly, as long as LD_LIBRARY_PATH is set as described above.

As a side note, I did not use easy_install-2.7 pycurl. I prefer downloading pycurl directly (from here) and using python2.7 setup.py install.

(09 Jun '13, 04:03) ryans ♦♦ ryans's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×5
×1
×1

Asked: 08 Jun '13, 21:18

Seen: 1,052 times

Last updated: 09 Jun '13, 04:06

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited