1:网页https://bootstrap.pypa.io/get-pip.py 复制网页内容,在linux创建文件名为get-pip.py文件,将网页内容写入到该文件中
2:执行sudo python3 get-pip.py 报错
dazuo is not in the sudoers file. This incident will be reported.
3:给/etc/sudoers文件添加写入权限 加上dazuo ALL=(ALL) ALL 去掉/etc/sudoers的写权限
4:执行sudo python3 get-pip.py
[sudo] password for dazuo: Collecting pip Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 1.3MB/s Collecting wheel Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl (41kB) 100% |████████████████████████████████| 51kB 2.3MB/s Installing collected packages: pip, wheel Found existing installation: pip 9.0.1 Uninstalling pip-9.0.1: Successfully uninstalled pip-9.0.1 The script wheel is installed in '/usr/python/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.Successfully installed pip-10.0.1 wheel-0.31.1
5:添加/usr/python/bin到全局环境变量,编辑/etc/profile 添加
PATH=$PATH:/usr/python/bin/
export PATH
执行source /etc/profile
6:安装matplotlib
执行pip3 install matplotlib
Collecting matplotlib Downloading https://files.pythonhosted.org/packages/49/b8/89dbd27f2fb171ce753bb56220d4d4f6dbc5fe32b95d8edc4415782ef07f/matplotlib-2.2.2-cp36-cp36m-manylinux1_x86_64.whl (12.6MB) 100% |████████████████████████████████| 12.6MB 54kB/s Collecting six>=1.10 (from matplotlib) Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)",)': /simple/six/ Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whlCollecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib) Downloading https://files.pythonhosted.org/packages/6a/8a/718fd7d3458f9fab8e67186b00abdd345b639976bc7fb3ae722e1b026a50/pyparsing-2.2.0-py2.py3-none-any.whl (56kB) 100% |████████████████████████████████| 61kB 62kB/s Collecting python-dateutil>=2.1 (from matplotlib) Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB) 100% |████████████████████████████████| 215kB 39kB/s Collecting cycler>=0.10 (from matplotlib) Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whlCollecting kiwisolver>=1.0.1 (from matplotlib) Downloading https://files.pythonhosted.org/packages/69/a7/88719d132b18300b4369fbffa741841cfd36d1e637e1990f27929945b538/kiwisolver-1.0.1-cp36-cp36m-manylinux1_x86_64.whl (949kB) 100% |████████████████████████████████| 952kB 141kB/s Collecting pytz (from matplotlib) Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB) 100% |████████████████████████████████| 512kB 31kB/s Collecting numpy>=1.7.1 (from matplotlib) Downloading https://files.pythonhosted.org/packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (12.2MB) 100% |████████████████████████████████| 12.2MB 44kB/s Requirement already satisfied: setuptools in /usr/python/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib) (28.8.0)Installing collected packages: six, pyparsing, python-dateutil, cycler, kiwisolver, pytz, numpy, matplotlibSuccessfully installed cycler-0.10.0 kiwisolver-1.0.1 matplotlib-2.2.2 numpy-1.14.5 pyparsing-2.2.0 python-dateutil-2.7.3 pytz-2018.5 six-1.11.0