“Pip安装和使用”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
docker>Evan
 
 
(未显示同一用户的6个中间版本)
第1行: 第1行:
 +
== 安装pip3==
 +
<pre>
 +
 +
wget https://bootstrap.pypa.io/get-pip.py
 +
python3 get-pip.py
 +
 +
#debian 还可以这样
 +
apt-get install python3-pip
 +
 +
apt install python-pip
 +
</pre>
 +
 +
python3 自带了pip3
 +
 +
[[Centos7 python3 and pip3]]
 +
 +
[[Pip更换为国内源]]
 +
 
== 升级 pip==
 
== 升级 pip==
 
  rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 
  rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 
  yum install -y python-pip
 
  yum install -y python-pip
 
  
 
==安装 ==
 
==安装 ==
第100行: 第117行:
 
–exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
 
–exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
 
–cert 证书. </pre>
 
–cert 证书. </pre>
 +
 +
== error: externally-managed-environment==
 +
 +
sudo pip3 install virtualenv error: externally-managed-environment
 +
 +
use pip's argument --break-system-packages,
 +
add following lines to ~/.config/pip/pip.conf:
 +
[global]
 +
break-system-packages = true
 +
  
 
==参考==
 
==参考==

2024年10月9日 (三) 02:21的最新版本

安装pip3


wget https://bootstrap.pypa.io/get-pip.py
 python3 get-pip.py 

#debian 还可以这样 
apt-get install python3-pip

apt install python-pip

python3 自带了pip3

Centos7 python3 and pip3

Pip更换为国内源

升级 pip

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install -y python-pip

安装

前提

How to install python2.7 on centos6.x

#第一种 官方推荐办法 
#on rhel 7  或者 centos6 有python2.7 
wget https://bootstrap.pypa.io/get-pip.py
python  get-pip.py

#第二种 源码 
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
tar xvf pip-9.0.1.tar.gz && cd pip-9.0.1/
sudo python setup.py install

#第三种  easy_install

1.下载easy_install

[root@client home] wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
[root@client home] python ez_setup.py
#如果提示 IOError: [Errno url error] unknown url type: 'https'  错误就是没有安装openssl-devel 导致,yum安装openssl-devel 然后再重新编译安装Python2.7
 
#安装完成后可以看到/usr/local/bin/ 有两个文件
[root@client bin]#  ll easy_install*
-rwxr-xr-x. 1 root root 409 12月  5 18:56 easy_install
-rwxr-xr-x. 1 root root 417 12月  5 18:56 easy_install-2.7
2.安装pip

[root@client home] easy_install pip
[root@client home] pip -V
pip 9.0.1 from /usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)


 

2. pip使用详解

2.1 pip安装包
pip install SomePackage
2.2 pip查看已安装的包
pip show –files SomePackage
2.3 pip检查哪些包需要更新
pip list –outdated
SomePackage (Current: 1.0 Latest: 2.0)
2.4 pip升级包
pip install –upgrade SomePackage

2.5 pip卸载包

$ pip uninstall SomePackage

3. pip使用实例
3.1 安装Django

pip install Django

3.2 卸载Django

pip uninstall Django

3.3 查看待更新包
pip list –outdate

4. pip参数解释

pip –help

Usage:
pip [options]

Commands:
install 安装包.
uninstall 卸载包.
freeze 按着一定格式输出已安装包列表
list 列出已安装包.
show 显示包详细信息.
search 搜索包,类似yum里的search.
wheel Build wheels from your requirements.
zip 不推荐. Zip individual packages.
unzip 不推荐. Unzip individual packages.
bundle 不推荐. Create pybundles.
help 当前帮助.

General Options:
-h, –help 显示帮助.
-v, –verbose 更多的输出,最多可以使用3次
-V, –version 现实版本信息然后退出.
-q, –quiet 最少的输出.
–log-file 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log
–log 不覆盖记录verbose输出的日志.
–proxy Specify a proxy in the form [user:passwd@]proxy.server:port.
–timeout 连接超时时间 (默认15秒).
–exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
–cert 证书. 

error: externally-managed-environment

sudo pip3 install virtualenv error: externally-managed-environment

use pip's argument --break-system-packages, add following lines to ~/.config/pip/pip.conf: [global] break-system-packages = true


参考

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

pip 安装和使用 http://blog.linuxchina.net/?p=2793


How to install python2.7 on centos6.x