I have created a python virtual environment using virtualenv, after activating it, I can see where is Python installed in my shell as following:
(virtualenv-test) bash-4.1$ whereis python
python: /usr/bin/python2.6 /usr/bin/python2.6-config /usr/bin/python
/usr/lib/python2.6 /usr/lib64/python2.6 /usr/X11R6/bin/python2.6
/usr/X11R6/bin/python2.6-config /usr/X11R6/bin/python
/usr/bin/X11/python2.6 /usr/bin/X11/python2.6-config
/usr/bin/X11/python /usr/include/python2.6
/usr/share/man/man1/python.1.gz
Also I can see what python version I’m using:
(virtualenv-test) bash-4.1$ which python
/data/virtualenv-test/bin/python
However, after typing python, I got the following error message:
(virtualenv-test) bash-4.1$ python
python: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory
What can be the underlying reason?
Rohit Patel
Try adding the python3.4’s lib path to the
$LD_LIBRARY_PATH
environment variable.First find out the lib path of python3.4 (depends on how you installed python3.4)
For me it was:
/opt/python361/lib
, then add it to environment variable like so:P.S.
I came across a similar problem while using
virtualenv
withpython3.6
, and I fixed it like so:include <lib path of python3.x>
to/etc/ld.so.conf
(Something like:include /opt/python361/lib
orinclude /usr/local/lib
)sudo /sbin/ldconfig -v
.