Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to import readline in django shell python

I am on Centos 6 Linux

When i try this

Python 2.7.3 (default, Nov 23 2012, 18:02:22)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import readline
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named readline
>>>

I try to install python readline with pip and i get this

 virtualenv/bin/pip-2.7 install readline
Requirement already satisfied (use --upgrade to upgrade): readline in ./virtualenv/lib/python2.7/site-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg
Cleaning up...

what should i do

EDIT:

I tried this as well

[myhost]$ virtualenv/bin/python2.7
Python 2.7.3 (default, Nov 23 2012, 18:02:22)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named readline
>>>

I tried all that

(virtualenv)[aaaaaa]$ source virtualenv/bin/activate
(virtualenv)[aaaaaa]$ virt
virtualenv/                virtualenv-clone           virtualenvwrapper.sh
virtualenv-2.7             virtualenvwrapper_lazy.sh  virt-what
(virtualenv)[aaaaaa]$ virtualenv/bin/pip
pip      pip-2.7
(virtualenv)[aaaaa]$ virtualenv/bin/pip install readline
Requirement already satisfied (use --upgrade to upgrade): readline in ./virtualenv/lib/python2.7/site-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg
Cleaning up...
(virtualenv)[aaaaa]$ python
Python 2.7.3 (default, Nov 23 2012, 18:02:22)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named readline
>>>

I tried all vitual env and activating as well. But again i get same error

like image 573
user1958218 Avatar asked Sep 09 '26 04:09

user1958218


1 Answers

You need to actually activate the environment you want to use, not just run the python binary from the enviroments bin folder:

$ source /path/to/envirn/bin/activate
$ pip install readline
$ python 
> import readline
like image 103
Timmy O'Mahony Avatar answered Sep 10 '26 19:09

Timmy O'Mahony



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!