How to Install Libpython2.7.So

How to install libpython2.7.so

You could try compiling it from sources, in root :

yum -y install python-devel openssl openssl-devel gcc sqlite-devel

wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
tar -xvjf Python-2.7.5.tar.bz2
cd Python-2.7.5
./configure --prefix=/usr/local/python2.7 --with-threads --enable-shared
make
make install altinstall

ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib
ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib
ln -s /usr/local/python2.7/bin/python2.7 /usr/local/bin
/sbin/ldconfig -v

Then test getting correct python
/usr/local/python2.7/bin/python2.7 -V

And, as normal user :

echo "alias python='/usr/local/python2.7/bin/python2.7'" >> ~/.bashrc
source ~/.bashrc
python -V

Good luck :)

PyInstaller cannot find libpython2.7.so when making binary?

In the server I am using, there's only /usr/lib/python2.6 and not /usr/lib/python2.7 but python 2.7 is used routinely by me and is functional, etc. so I don't see it why it would be a problem to find its libraries. There is a /usr/local/lib/libpython2.7.a.

If there is no libpython2.7.so, of course it will be a problem to find that library.

The reason you're able to use the Python interpreter is probably that it's statically linked.

There are two ways to solve this.

First, you could just install the shared libraries for your Python 2.7. If you're using an older version of Ubuntu that came with, say, Python 2.6, and you installed 2.7 from the python2.7 package, this should just be a matter of installing libpython2.7.

If you've gotten your 2.7 from some other source, the Ubuntu libpython2.7 package obviously won't work—or it'll work by installing a second copy of python2.7, possibly overwriting some of the files you already have, and definitely confusing you. Either way, don't do it. Either get the rest of Python for your existing 2.7, or uninstall that 2.7 and use the Ubuntu packages. (For some Python distributions, "get the rest of it" is impossible, because if you install the shared libs, you get a dynamically-linked Python executable instead of your statically-linked one. In that case, you pretty much have to uninstall and reinstall.)

Second, you could use PyInstaller's static-lib support. See ticket 420 for details, but the simple idea is that, if this is enabled, and PyInstaller thinks your platform should have a libpython2.7.so but can't find it, it will look for a libpython2.7.a and statically link that instead. Last time I needed this, it wasn't checked into trunk. From a quick glance at the ticket, it looks like the patch is now included, but disabled in default PyInstaller builds, and the milestone is set to 3.0, so, you may still have to manually build PyInstaller to get this to work.

One last thing: It's possible that you do have libpython2.7.so, but it's just installed somewhere weird like /opt/python27/lib or something, with /opt/python27 nowhere on your path, but /usr/local/bin/python27 can find it because it's explicitly built to get stuff out of /opt/python27. This kind of thing tends to be a problem only for Mac users with MacPorts or Fink, not Linux users, but it's not impossible. You can look at the dl table for /usr/local/bin/python27 if you think this might be the issue.



Related Topics



Leave a reply



Submit