我下载了Android的来源,但根据the website使用repo init
时,我收到以下错误:
Traceback (most recent call last):
File "/root/bin/repo", line 91, in <module>
import readline
ImportError: No module named readline
我正在使用Ubuntu 10.04和Python 2.7.2
答案 0 :(得分:3)
AFAIK,Ubuntu 10.04中的默认Python环境是Python 2.6.5,所以你必须使用自编译的python。
在构建python 2.7.2时,你应该缺少一些readline头文件,所以你现在有两个选择:
pip install readline
或easy_install readline
答案 1 :(得分:1)
我有同样的问题,我以这种方式修复它,希望它对你有所帮助。
$ 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