Ubuntu replacement and use of apt source and python source.md
One click change script content
#! /bin/bash echo "Set up image source of Zhejiang University" (cat << EOF deb http://mirrors.zju.edu.cn/ubuntu xenial main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu xenial-security main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu xenial-updates main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu xenial-backports main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial-security main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial-updates main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial-backports main universe restricted multiverse EOF ) | sudo tee /etc/apt/sources.list echo "Writing in Zhejiang University Ubuntu16.04 amd64 apt Mirror source complete" sudo apt update echo "Now let's change it Python Of Zju pipy Source:" cd ~ mkdir .pip cd .pip (cat << EOF index-url=http://mirrors.zju.edu.cn/pypi/web/simple trusted-host=mirrors.zju.edu.cn disable-pip-version-check =true EOF ) | sudo tee ~/.pip/pip.conf echo "Replace Zju Pipy Source completed" echo "Note if installation is required Python3 For the installation package of, use the following command: python3 -m pip install numpy" echo "Note if installation is required Python2 For the installation package of, use the following command: python2 -m pip install numpy" echo "It's not recommended to use it directly pip install Installation by python Bag, so you don't know what's in it python2 Bag or python3 Package"
Modify Ubuntu apt source
Open the / etc/apt/sources.list file, delete all the contents, add the following contents and save.
deb http://mirrors.zju.edu.cn/ubuntu xenial main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu xenial-security main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu xenial-updates main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu xenial-backports main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial-security main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial-updates main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu xenial-backports main universe restricted multiverse
Be careful:
The apt source modified in this way is valid for all users of the same system
Modify Ubunt u's Python source
Under the user's own home directory, create a new folder named. Pip, and then create a file named pip.conf under the. PIP folder. The content of the file is as follows: save it finally.
[global] index-url=http://mirrors.zju.edu.cn/pypi/web/simple trusted-host=mirrors.zju.edu.cn disable-pip-version-check =true
Be careful:
The pipy source modified in this form is only valid for the current user.
It is not recommended for users to install packages directly using pip install (it is easy to be unclear whether the packages installed are python3 or python2).
The following commands are recommended for installing python packages:
Note if you need to install the package for Python 3, use the following command: Python 3 - M PIP install numpy*** Note if you need to install the package for Python 2, use the following command: python2 -m pip install numpy***