关键词:python3 pip3 依赖安装 YUM安装PIP CentOS7
pip安装软件与yum安装软件是不兼容的,同一个软件包如果用pip已经安装过了,再使用yum安装则会报错,在涉及yum安装的包有依赖时要特别注意
步骤
yum install python3
#上面的命令会自动安装python3、pip3
更新pip3
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple/
# python3 -m pip --version
pip 20.2.4 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
冗余信息
Installed:
python3.x86_64 0:3.6.8-13.el7
Dependency Installed:
libtirpc.x86_64 0:0.2.4-0.16.el7 python3-libs.x86_64 0:3.6.8-13.el7 python3-pip.noarch 0:9.0.3-7.el7_7
python3-setuptools.noarch 0:39.2.0-10.el7
# which python3 ==> /usr/bin/python3
# which pip3 ==> /usr/bin/pip3
# python3 --version ==> Python 3.6.8
# pip3 --version ==> pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
python3 -m pip list
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple requests
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple paramiko
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple flask
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple python-dotenv
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple flask
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple PyMySQL
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple kafka-python
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple fastapi
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple uvicorn
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple docker
阿里云 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/
国内源
阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) https://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
一般都用https,http可能报错
命令行直接添加
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple requests
如果提示不信任,则
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com requests
python2 同理
修改配置文件
cat ~/.pip/pip.conf #没有这个文件则创建之
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
pip的freeze命令用于生成将当前项目的pip类库列表生成 requirements.txt 文件:
pip freeze > requirements.txt
安装requirements.txt中的类库内容
pip install -r requirements.txt
https://packaging.python.org/tutorials/installing-packages/#install-pip-setuptools-and-wheel
https://packaging.python.org/guides/installing-using-linux-tools/
https://packaging.python.org/tutorials/installing-packages/
步骤
#1. Enable the EPEL repository
参考 blog.csdn.net/xys2015/article/details/109378741 (迅速应用阿里云YUM在线仓库)
#2. 安装
yum install python-pip
yum install python-wheel
#3. 更新到最新
/usr/bin/python2 -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
#python -m pip install --upgrade pip 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
步骤
curl https://bootstrap.pypa.io/get-pip.py | python3
检查与测试
python3 -m pip list
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple requests
参考
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
步骤
curl https://bootstrap.pypa.io/get-pip.py | python
检查与测试
python2 -m pip list
which pip
pip --version
python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
参考
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
CentOS7 yum 安装 pip3 和 python3
https://blog.csdn.net/xys2015/article/details/109681645
CentOS7 yum 安装 pip2
https://blog.csdn.net/xys2015/article/details/109681699
macOS 安装 pip
https://editor.csdn.net/md?not_checkout=1&articleId=109681722