I am under Ubuntu 16.04 LTS.
I have two python installations. I am actually using them via pvpython, but this is likely irrelevant for the present question.
The versions are:
- Python 2.7.12, installed with
apt-get, residing in system dirs. - Python 2.7.11, residing in
~/apps/ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit, simply expanded from a tar file. To get the python prompt I run~/apps/ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin/pvpython.
I mean to use readline from version 1 in version 2 (since it does not have its own, strange as it may be). To do this:
Find where is
readlinein version 1:>>> import readline >>> readline.__file__ '/usr/lib/python2.7/lib-dynload/readline.x86_64-linux-gnu.so'Use it in version 2, following this. I placed needed stuff in a directory
dir1which is an element ofsys.path(I tried with both/home/santiago/apps/ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/lib/python2.7and/home/santiago/apps/ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/lib/python2.7/lib-dynload).2.1. Get the
.sofile.$ cd dir1 $ ln -s /usr/lib/python2.7/lib-dynload/readline.x86_64-linux-gnu.so2.2. Create
readline.py$ nano readline.pywith contents (as per ref above):
def __bootstrap(): global __bootstrap, __loader__, __file__ import sys, pkg_resources, imp __file__ = pkg_resources.resource_filename(__name__,'readline.x86_64-linux-gnu.so') __loader__ = None; del __bootstrap, __loader__ imp.load_dynamic(__name__,__file__) __bootstrap()
Now when I use version 2 with ~/apps/ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin/pvpython, I still get the error (that I wanted to get rid of)
ImportError: No module named readline
from an import in my ~/.pythonrc.
How can I import readline from version 1 into version 2?