pip

macOS python3 install pip

################################### 步骤 ###################################
curl https://bootstrap.pypa.io/get-pip.py | python3
pip3 --version
pip3 list
python3 -m pip list

################################### 参考  ###################################
https://www.jianshu.com/p/62bea7d3708c
https://pip.pypa.io/en/stable/installing/
Warning: pip is being invoked by an old script wrapper   
    https://stackoverflow.com/questions/60029215/warning-pip-is-being-invoked-by-an-old-script-wrapper


################################### 冗余信息 ###################################
as4k@bogon ~ % curl https://bootstrap.pypa.io/get-pip.py | python3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1825k  100 1825k    0     0   8876      0  0:03:30  0:03:30 --:--:-- 14231
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
  Downloading pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 9.6 kB/s 
Installing collected packages: pip
  WARNING: The scripts pip, pip3 and pip3.7 are installed in '/Users/as4k/Library/Python/3.7/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-20.1.1
WARNING: You are using pip version 19.0.3; however, version 20.1.1 is available.
You should consider upgrading via the '/Applications/Xcode.app/Contents/Developer/usr/bin/python3 -m pip install --upgrade pip' command.

as4k@bogon ~ % pip3 list
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Package    Version
---------- -------
pip        20.1.1
setuptools 40.8.0
six        1.12.0
wheel      0.33.1
as4k@bogon ~ % python3 -m pip list
Package    Version
---------- -------
pip        20.1.1
setuptools 40.8.0
six        1.12.0
wheel      0.33.1

macOS pip3 基本使用

python3 -m pip list

macOS python2 install pip

################################### 步骤 ###################################
curl https://bootstrap.pypa.io/get-pip.py | python
pip --version
pip list
python2 -m pip list

################################### 参考 ###################################
https://www.jianshu.com/p/62bea7d3708c
https://pip.pypa.io/en/stable/installing/

################################### 冗余信息 ###################################
as4k@bogon ~ % curl https://bootstrap.pypa.io/get-pip.py | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1825k  100 1825k    0     0  10168      0  0:03:03  0:03:03 --:--:--  7640
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
  Using cached pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  WARNING: The scripts pip, pip2 and pip2.7 are installed in '/Users/as4k/Library/Python/2.7/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-20.1.1

安装

https://packaging.python.org/tutorials/installing-packages/
https://packaging.python.org/guides/installing-using-linux-tools/

Enable the EPEL repository
yum install python-pip
yum install python-wheel
pip --version

Ensure pip, setuptools, and wheel are up to date
python -m pip install --upgrade pip setuptools wheel -i http://mirrors.aliyun.com/pypi/simple/
OR python -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple/

############################# 1 setuptools ############################################

https://pypi.org/project/setuptools/32.3.1/#files
https://files.pythonhosted.org/packages/e8/68/f968ebc015c7e0021e76b60b8cfd29f9ffbae4b3b58d96ad20045a99562e/setuptools-32.3.1.zip
unzip setuptools-32.3.1.zip
cd setuptools-32.3.1
python setup.py install


############################# 2 pip ##########################################################

https://pypi.org/project/pip/8.1.2/#files

https://files.pythonhosted.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz

tar xf pip-8.1.2.tar.gz
cd pip-8.1.2
python setup.py install

######################################### 更改国内镜像源 #################################################

pip更改国内源
国内源:

阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 
豆瓣(douban) http://pypi.douban.com/simple/ 
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

Linux环境:

可以直接使用镜像源,加 -i 指定地址:

1 sudo pip install -i http://pypi.douban.com/simple 模块名
如果出现不信任的报错:


则需要在命令后加上

1 sudo pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 模块名
每次都输入地址挺麻烦的,可以更改默认配置,~/.pip/pip.conf,一般这个文件需要自己创建。

文件内容:

[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

https://mirrors.tuna.tsinghua.edu.cn/help/pypi/