回购导入读取线错误

发布于 2024-11-26 03:11:43 字数 285 浏览 0 评论 0原文

我尝试按照 http://source.android.com/source/downloading 中所述使用 Android .html,但是当我使用repo时,我遇到了这个错误:
导入阅读线 ImportError:没有名为 readline 的模块

我使用的是 Ubuntu 11.04 和 Python 2.7。

如果有人能帮助我,我将不胜感激。

I have tried to work with Android as described in http://source.android.com/source/downloading.html, but when I used repo, I have faced with this error:
import readline
ImportError: No module named readline

I am using Ubuntu 11.04 and Python 2.7.

I will be appreciated if anybody can help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

來不及說愛妳 2024-12-03 03:11:43

尝试安装libreadline5-dev

Try installing libreadline5-dev

手长情犹 2024-12-03 03:11:43

readline 不可用,因为 python 安装时没有 readline 模块。您需要重新编译包含 readline 的 Python。你可以这样做,祝你好运!

$ source Install_Python2.7.5.sh

Shell脚本“Install_Python2.7.5.sh”如下所示:

#!/bin/bash

sudo apt-get install libreadline-dev

sudo aptitude install build-essential libreadline5-dev

sudo apt-get install libbz2-dev

if [ ! -d ~/software/Python/Python-2.7.5 ]; then

    mkdir ~/software
    mkdir ~/software/Python
    mkdir ~/software/Python/Python-2.7.5
fi

if [ ! -d ~/bin ]; then

    mkdir ~/bin
fi

user_root=~

echo $user_root

echo "unpackage Python-2.7.5.tar.bz2..."

tar -jxvf Python-2.7.5.tar.bz2 

echo "prepear to install Python-2.7.5"

cd Python-2.7.5

sed -i "s/#readline/readline/g" Modules/Setup.dist

echo "Start to install Python-2.7.5"

./configure --prefix=$user_root/software/Python/Python-2.7.5/  && make && make install

echo "Make symbol link"

ln -s -f $user_root/software/Python/Python-2.7.5/bin/* $user_root/bin

echo "Set environment variable"

PATH=$user_root/bin:$PATH

The readline is not avaliable becase the python installed with out readline module. You need to recompile your Python with readline included. You can do it like this, good luck!

$ source Install_Python2.7.5.sh

Shell script "Install_Python2.7.5.sh" is like this:

#!/bin/bash

sudo apt-get install libreadline-dev

sudo aptitude install build-essential libreadline5-dev

sudo apt-get install libbz2-dev

if [ ! -d ~/software/Python/Python-2.7.5 ]; then

    mkdir ~/software
    mkdir ~/software/Python
    mkdir ~/software/Python/Python-2.7.5
fi

if [ ! -d ~/bin ]; then

    mkdir ~/bin
fi

user_root=~

echo $user_root

echo "unpackage Python-2.7.5.tar.bz2..."

tar -jxvf Python-2.7.5.tar.bz2 

echo "prepear to install Python-2.7.5"

cd Python-2.7.5

sed -i "s/#readline/readline/g" Modules/Setup.dist

echo "Start to install Python-2.7.5"

./configure --prefix=$user_root/software/Python/Python-2.7.5/  && make && make install

echo "Make symbol link"

ln -s -f $user_root/software/Python/Python-2.7.5/bin/* $user_root/bin

echo "Set environment variable"

PATH=$user_root/bin:$PATH
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文