python curl_get-pip.py Installing with get-pip.py

curl https://bootstrap.pypa.io/get-pip.py > curl_get-pip.py
python curl_get-pip.py

https://pip.pypa.io/en/stable/installing/

curl https://bootstrap.pypa.io/get-pip.py > curl_get-pip.py

wuser@ubuntu:~$ pip install -U pip setuptools
The program 'pip' is currently not installed. You can install it by typing:
sudo apt install python-pip
wuser@ubuntu:~$ python get-pip.py
python: can't open file 'get-pip.py': [Errno 2] No such file or directory
wuser@ubuntu:~$ python https://bootstrap.pypa.io/get-pip.py
python: can't open file 'https://bootstrap.pypa.io/get-pip.py': [Errno 2] No such file or directory
wuser@ubuntu:~$ pwd
/home/wuser
wuser@ubuntu:~$ ll
total 28
drwxr-xr-x 3 wuser wuser 4096 May  2 19:52 ./
drwxr-xr-x 3 root  root  4096 May  2 00:31 ../
-rw-r--r-- 1 wuser wuser  220 May  2 00:31 .bash_logout
-rw-r--r-- 1 wuser wuser 3771 May  2 00:31 .bashrc
drwx------ 2 wuser wuser 4096 May  2 00:32 .cache/
-rw-rw-r-- 1 wuser wuser    9 May  2 19:52 .dbshell
-rw------- 1 wuser wuser    0 May  2 19:52 .mongorc.js
-rw-r--r-- 1 wuser wuser  655 May  2 00:31 .profile
-rw-r--r-- 1 wuser wuser    0 May  2 00:33 .sudo_as_admin_successful
wuser@ubuntu:~$ curl https://bootstrap.pypa.io/get-pip.py > curl_get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1558k  100 1558k    0     0   196k      0  0:00:07  0:00:07 --:--:--  331k
wuser@ubuntu:~$ ls
curl_get-pip.py
wuser@ubuntu:~$ python curl_get-pip.py
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 18kB/s 
Collecting setuptools
  Downloading setuptools-35.0.2-py2.py3-none-any.whl (390kB)
    100% |████████████████████████████████| 399kB 59kB/s 
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 22kB/s 
Collecting appdirs>=1.4.0 (from setuptools)
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools)
  Downloading packaging-16.8-py2.py3-none-any.whl
Collecting six>=1.6.0 (from setuptools)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 72kB/s 
Installing collected packages: pip, appdirs, pyparsing, six, packaging, setuptools, wheel
Exception:
Traceback (most recent call last):
  File "/tmp/tmpO7xHXx/pip.zip/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmpO7xHXx/pip.zip/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/tmp/tmpO7xHXx/pip.zip/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/tmp/tmpO7xHXx/pip.zip/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/tmp/tmpO7xHXx/pip.zip/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/tmp/tmpO7xHXx/pip.zip/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/tmp/tmpO7xHXx/pip.zip/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/tmp/tmpO7xHXx/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip'
wuser@ubuntu:~$ sudo python curl_get-pip.py
The directory '/home/wuser/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/wuser/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 18kB/s 
Collecting setuptools
  Downloading setuptools-35.0.2-py2.py3-none-any.whl (390kB)
    100% |████████████████████████████████| 399kB 17kB/s 
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 10kB/s 
Collecting appdirs>=1.4.0 (from setuptools)
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools)
  Downloading packaging-16.8-py2.py3-none-any.whl
Collecting six>=1.6.0 (from setuptools)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 17kB/s 
Installing collected packages: pip, appdirs, pyparsing, six, packaging, setuptools, wheel
Successfully installed appdirs-1.4.3 packaging-16.8 pip-9.0.1 pyparsing-2.2.0 setuptools-35.0.2 six-1.10.0 wheel-0.29.0
wuser@ubuntu:~$ 
原文地址:https://www.cnblogs.com/rsapaper/p/6800854.html