1、环境
Ubuntu 14.04.6 虚拟机
2、安装rope
1、切换普通用户
2、cd /home/用户家目录
3、mkdir ~/bin 新建目录
4、PATH=~/bin:$PATH 加到路径中
5、curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo 这步有时候会不成功,断掉,可以重新操作直到成功
6、chmod a+x ~/bin/repo 加可执行权限
3、 初始化rope
1、mkdir WORKING_DIRECTORY 新建目录,用于存放android源码
2、cd WORKING_DIRECTORY 进到目录里面
3、git config --global user.name "Your Name" 这里提示我git没有安装,按它上面的提示安装上再运行即可
git config --global user.email "you@example.com"
4、repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest 运行 repo init 以获取最新版本的 Repo 及其最近的所有错误更正内容
repo: warning: Python 2 is no longer supported; Please upgrade to Python 3.6+. 报错:意思要是用Python3.6+的版本,而我的是系统自带的:Python 2.7.6,先进行升级操作
5、安装完python3.7.1后再执行
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest 报错:fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
解决办法:
打开~/bin/repo文件并修改google地址
# vi ~/bin/repo
原来
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
修改为
REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
6、初始化并指定版本:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r8
7、同步源码:
repo sync 会很长时间,网传整个源码的大小为36.5G,但是我下载完是96G,先不管了
Checking out projects: 100% (668/668), done. 看到这个应该是完成了
repo sync has finished successfully
dongying@dongying-virtual-machine:~$ du -h --max-depth=1 查看目录大小
684K ./.local
249M ./tools
360K ./.config
12K ./.dbus
44K ./bin
4.0K ./桌面
96G ./android9
12K ./.presage
4.0K ./图片
8.0K ./.gnupg
20K ./.repoconfig
4.0K ./.gconf
4.0K ./视频
4.0K ./音乐
4.0K ./模板
7.8M ./.cache
4.0K ./文档
4.0K ./公共的
4.0K ./下载
96G .
4、升级安装Python3.6+
1、sudo apt update 更新源,报错类似:W: GPG error: http://mirrors.163.com precise-security Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key
解决操作1:把虚拟机网络改为桥接方式,类似报错减少,但依旧存在
解决操作2:更新所有KEY,问题解决
sudo apt-get clean
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update
2、下载安装必要的软件
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev
3、下载源码包
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
4、解压缩
tar -zxvf Python-3.7.1.tgz
5、新建安装目录,执行配置文件,编译,安装
mkdir /usr/local/python3.7.1 安装目录
cd Python-3.7.0/ 进到解开的目录
./configure --prefix=/usr/local/python3.7.1 --with-ssl 配置文件
make 编译
make install 安装
6、做软链,能查看版本号则升级成功
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python 这个操作不成功,发现/usr/bin/python3有这个文件,然后先把原来的改了个名,再操作成功
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip
[root@note-13 shell]# python -V 查看版本号
Python 3.7.0
[root@note-13 shell]# pip -V
pip 19.0.3 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)