pip 与 pip3 区别

pip 与 pip3 区别

  • 电脑同时有多个版本的 python 时,pip3 可以自动判别用 python3 来安装库,是为了避免同 python2 发生冲突。
  • 如果你的电脑仅仅安装了 python3,使用 pip 或者 pip3 是一样的。

pip install xxxxxx
新安装的库会放在这个目录下面:python2.7/site-packages

pip3 install xxxxxx
新安装的库会放在这个目录下面:python3.6/site-packages

如果使用 python3 执行程序,那么就不能 import python2.7/site-packages 中的库。

pip3 always operates on the Python3 environment only, as pip2 does with Python2. pip operates on whichever environment is appropriate to the context. For example if you are in a Python3 venv, pip will operate on the Python3 environment.

appropriate [əˈprəʊpriət , əˈprəʊprieɪt]:adj.	合适的,恰当的 v. 盗用,挪用,占用,侵吞,拨 (专款等)
strong@foreverstrong:~$ which pip
/usr/local/bin/pip
strong@foreverstrong:~$ 
strong@foreverstrong:~$ which pip3
strong@foreverstrong:~$ 
strong@foreverstrong:~$ which python
/usr/bin/python
strong@foreverstrong:~$ 
strong@foreverstrong:~$ which python3
/usr/bin/python3
strong@foreverstrong:~$ 
strong@foreverstrong:~$ pip -V
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
strong@foreverstrong:~$ 
strong@foreverstrong:~$ pip3 -V
The program 'pip3' is currently not installed. You can install it by typing:
sudo apt install python3-pip
strong@foreverstrong:~$ 
strong@foreverstrong:~$ pip list
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
Package                            Version    
---------------------------------- -----------
adium-theme-ubuntu                 0.3.4      
attrs                              15.2.0     
autobahn                           0.10.3     
backports-abc                      0.5        
backports.functools-lru-cache      1.4        
backports.shutil-get-terminal-size 1.0.0      
backports.weakref                  1.0rc1     
bleach                             1.5.0      
colour                             0.1.5      
configparser                       3.5.0      
cryptography                       1.2.3      
cycler                             0.10.0     
Cython                             0.28.2     
decorator                          4.1.2      
descartes                          1.1.0      
entrypoints                        0.2.3      
enum34                             1.1.6      
funcsigs                           1.0.2      
functools32                        3.2.3.post2
futures                            3.0.5      
goto                               1.0        
heatmap                            2.2.1      
hmmlearn                           0.2.0      
html5lib                           0.9999999  
idna                               2.0        
imutils                            0.4.6      
ipaddress                          1.0.16     
ipykernel                          4.8.2      
ipython                            5.7.0      
ipython-genutils                   0.2.0      
ipywidgets                         7.2.1      
Jinja2                             2.10       
joblib                             0.9.4      
jsonschema                         2.6.0      
jupyter                            1.0.0      
jupyter-client                     5.2.3      
jupyter-console                    5.2.0      
jupyter-core                       4.4.0      
lxml                               4.2.3      
lz4                                0.7.0      
Markdown                           2.6.9      
MarkupSafe                         1.0        
matplotlib                         2.1.1      
meld                               3.14.2     
mistune                            0.8.3      
mock                               2.0.0      
mpi4py                             1.3.1      
msgpack-python                     0.4.6      
mvnc                               1.11.0.2   
nbconvert                          5.3.1      
nbformat                           4.4.0      
networkx                           2.0        
nose                               1.3.7      
notebook                           5.5.0      
numpy                              1.13.3     
olefile                            0.44       
PAM                                0.4.2      
pandocfilters                      1.4.2      
pathlib2                           2.3.2      
pbr                                3.1.1      
pexpect                            4.6.0      
pickleshare                        0.7.4      
Pillow                             4.3.0      
pip                                18.0       
poster                             0.8.1      
prompt-toolkit                     1.0.15     
protobuf                           3.4.0      
psutil                             5.4.0      
ptyprocess                         0.5.2      
pyasn1                             0.1.9      
pyasn1-modules                     0.0.7      
Pygments                           2.2.0      
pygobject                          3.20.0     
pyOpenSSL                          0.15.1     
pyparsing                          2.2.0      
pyserial                           3.0.1      
Pyste                              0.9.10     
python-dateutil                    2.6.1      
python-snappy                      0.5        
pytz                               2017.3     
PyWavelets                         0.5.2      
pyzmq                              17.0.0     
qtconsole                          4.3.1      
scandir                            1.7        
scikit-image                       0.13.1     
scikit-learn                       0.19.1     
scipy                              1.0.0      
Send2Trash                         1.5.0      
service-identity                   16.0.0     
setuptools                         36.6.0     
Shapely                            1.6.4.post1
simplegeneric                      0.8.1      
simplejson                         3.8.1      
singledispatch                     3.4.0.3    
six                                1.11.0     
subprocess32                       3.2.7      
tensorflow-gpu                     1.3.0      
tensorflow-tensorboard             0.1.8      
terminado                          0.8.1      
testpath                           0.3.1      
tornado                            5.0.2      
traitlets                          4.3.2      
trollius                           2.0.1      
Twisted                            16.0.0     
txaio                              1.0.0      
unity-lens-photos                  1.0        
virtualenv                         15.1.0     
wcwidth                            0.1.7      
Werkzeug                           0.12.2     
wheel                              0.30.0     
widgetsnbextension                 3.2.1      
zope.interface                     4.1.3      
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
strong@foreverstrong:~$ 
strong@foreverstrong:~$ pip show hmmlearn
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
Name: hmmlearn
Version: 0.2.0
Summary: Hidden Markov Models in Python with scikit-learn like API
Home-page: https://github.com/hmmlearn/hmmlearn
Author: Sergei Lebedev
Author-email: superbobry@gmail.com
License: new BSD
Location: /home/strong/.local/lib/python2.7/site-packages
Requires: 
Required-by: 
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
strong@foreverstrong:~$ 
strong@foreverstrong:~$ pip3 list
The program 'pip3' is currently not installed. You can install it by typing:
sudo apt install python3-pip
strong@foreverstrong:~$ 
  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值