Ipython没有可用的readline, pip安装readline错误

时间:2021-10-15 16:54:23

I installed ipython but it doesn't have the readline option. I first downloaded gnu readline and compiled and installed. DIdn't know whether it was a proper solution but was the first thing I thought of. It still wouldn't work to no avail with the same error as before:

我安装了ipython,但是它没有readline选项。我首先下载了gnu readline并进行了编译和安装。我不知道这是不是一个合适的解决方案,但这是我想到的第一件事。它仍然不起作用,与以前同样的错误:

WARNING: Readline services not available on this platform.
WARNING: The auto-indent feature requires the readline library

Then I tried using pip install readline and I get the error below. Any help would be appreciated:

然后我尝试使用pip安装readline,得到下面的错误。如有任何帮助,我们将不胜感激:

running install

running build

running build_ext

building 'readline' extension

creating build

creating build/temp.linux-x86_64-2.6

creating build/temp.linux-x86_64-2.6/Modules

creating build/temp.linux-x86_64-2.6/Modules/2.x

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/home/jspender/include/python2.6 -c Modules/2.x/readline.c -o build/temp.linux-x86_64-2.6/Modules/2.x/readline.o -Wno-strict-prototypes

creating build/lib.linux-x86_64-2.6

gcc -pthread -shared build/temp.linux-x86_64-2.6/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -L/home/jspender/lib -lncurses -lpython2.6 -o build/lib.linux-x86_64-2.6/readline.so

/usr/bin/ld: cannot find -lncurses

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/jspender/bin/python2.6 -c "import setuptools;__file__='/home/jspender/build/readline/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-lBWIOm-record/install-record.txt failed with error code 1
Storing complete log in /home/jspender/.pip/pip.log

3 个解决方案

#1


69  

tmaric is right. I had the same problem while installing iPython (Ubuntu 12.10, quantal, 32-bit). I was missing the dev version of the ncurses5 library. Try:

tmaric是正确的。我在安装iPython时也遇到了同样的问题(Ubuntu 12.10, quantal, 32位)。我错过了ncurses5库的开发版本。试一试:

sudo apt-get install libncurses5-dev

and then installing the readline module again through pip

然后再通过pip安装readline模块

pip install readline

#2


3  

You have a linker error: library ncurses is not installed, or it is installed and the linker is searching for the wrong object file.

您有一个链接器错误:没有安装library ncurses,也没有安装它,链接器正在搜索错误的对象文件。

What platform/operating system are you using?

你使用的是什么平台/操作系统?

If you're running Linux/Unix, try:

如果您正在运行Linux/Unix,请尝试:

locate libncurses

to see if the library is installed. If there are no libncurses*.{o,so,so.[0-9].[0-9]} files on your system, just install the library, and the readline. If there are some, then check which one is searched for by the readline compilation process, it could be that you just have to make a symbolic link, naming the library file properly.

查看库是否已安装。如果没有libncurses*.{o,so,so.[0-9]。[0-9]}在您的系统上安装了库和readline。如果有的话,那么检查一下readline编译过程搜索的是哪个,可能您只需要创建一个符号链接,正确地命名库文件。

#3


1  

I had the same issue with my Ubuntu 14.04 install trying to get some python libraries installed. iPython I believe requires readline which was failing for me until I ran the following commands.

我的Ubuntu 14.04安装遇到了同样的问题,我试图安装一些python库。我认为iPython需要readline,但在我运行以下命令之前,它一直失败。

sudo apt-get install python-dev
sudo apt-get install libncurses5-dev
sudo pip install readline

#1


69  

tmaric is right. I had the same problem while installing iPython (Ubuntu 12.10, quantal, 32-bit). I was missing the dev version of the ncurses5 library. Try:

tmaric是正确的。我在安装iPython时也遇到了同样的问题(Ubuntu 12.10, quantal, 32位)。我错过了ncurses5库的开发版本。试一试:

sudo apt-get install libncurses5-dev

and then installing the readline module again through pip

然后再通过pip安装readline模块

pip install readline

#2


3  

You have a linker error: library ncurses is not installed, or it is installed and the linker is searching for the wrong object file.

您有一个链接器错误:没有安装library ncurses,也没有安装它,链接器正在搜索错误的对象文件。

What platform/operating system are you using?

你使用的是什么平台/操作系统?

If you're running Linux/Unix, try:

如果您正在运行Linux/Unix,请尝试:

locate libncurses

to see if the library is installed. If there are no libncurses*.{o,so,so.[0-9].[0-9]} files on your system, just install the library, and the readline. If there are some, then check which one is searched for by the readline compilation process, it could be that you just have to make a symbolic link, naming the library file properly.

查看库是否已安装。如果没有libncurses*.{o,so,so.[0-9]。[0-9]}在您的系统上安装了库和readline。如果有的话,那么检查一下readline编译过程搜索的是哪个,可能您只需要创建一个符号链接,正确地命名库文件。

#3


1  

I had the same issue with my Ubuntu 14.04 install trying to get some python libraries installed. iPython I believe requires readline which was failing for me until I ran the following commands.

我的Ubuntu 14.04安装遇到了同样的问题,我试图安装一些python库。我认为iPython需要readline,但在我运行以下命令之前,它一直失败。

sudo apt-get install python-dev
sudo apt-get install libncurses5-dev
sudo pip install readline