DGZ's Blog.

ubuntu18.04换源问题

Word count: 353Reading time: 1 min
2019/12/01 Share

ubuntu18.04换源,装pwntools问题


title: ubuntu18.04换源,装pwntools问题

tags:

 - ubuntu

首先当然要安装好vmware tools

换源

备份源

1
sudo cp /etc/apt/sources.list /etc/apt/sources_init.list

更换源

用gedit文本编辑器就相当方便,不知道为什么一堆人用vim

1
sudo gedit /etc/apt/sources.list

删除文件中的所有内容,替换成
1
2
3
4
5
6
7
8
9
10
11
# 阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

1
2
sudo apt update
sudo apt upgrade

安装pwntools(可参考)

pwntools需要python3的环境了

1
2
3
4
apt-get update
apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools.git@dev3

未解决问题(已解决)

pip3 ImportError: cannot import name ‘main’
解决方法

1
2
3
4
5
6
7
8
9
sudo gedit /usr/bin/pip
将:
from pip import main
if __name__ == '__main__':
sys.exit(main())
替换成:
from pip import __main__
if __name__ == '__main__':
sys.exit(__main__._main())

最后输入
1
2
3
4
pip install pwntools --user

#因为可能出现ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/filelock.py'
Consider using the `--user` option or check the permissions.

CATALOG
  1. 1. ubuntu18.04换源,装pwntools问题
    1. 1.1. 换源
      1. 1.1.1. 备份源
      2. 1.1.2. 更换源
    2. 1.2. 安装pwntools(可参考)
    3. 1.3. 未解决问题(已解决)