pipとpip3の違い



Difference Between Pip



pipとpip3の違い

  • コンピューターに同時に複数のバージョンのpythonがある場合、pip3は、python2との競合を回避するために、python3を使用してライブラリをインストールすることを自動的に決定できます。
  • コンピューターにpython3のみがインストールされている場合、pipまたはpip3の使用は同じです。

python3をインストールすると、pip3が表示されます。
pip install xxxxxx
新しくインストールされたライブラリは、次のディレクトリに配置されます:python2.7 / site-packages

pip3インストールxxxxxx
新しくインストールされたライブラリは、次のディレクトリに配置されます:python3.6 / site-packages
python3を使用してプログラムを実行する場合、python2.7 / site-packagesからライブラリをインポートすることはできません。



pip2がPython2で行うように、pip3は常にPython3環境でのみ動作します。 pipは、コンテキストに適した環境で動作します。 たとえば、Python3 venvを使用している場合、pipはPython3環境で動作します。

root@xxxxx:~$ which pip /usr/local/bin/pip root@xxxxx:~$ root@xxxxx:~$ which pip3 root@xxxxx:~$ root@xxxxx:~$ which python /usr/bin/python root@xxxxx:~$ root@xxxxx:~$ which python3 /usr/bin/python3 root@xxxxx:~$ root@xxxxx:~$ 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) root@xxxxx:~$ root@xxxxx:~$ pip3 -V The program 'pip3' is currently not installed. You can install it by typing: sudo apt install python3-pip root@xxxxx:~$ root@xxxxx:~$ 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. root@xxxxx:~$ root@xxxxx:~$ 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: root@xxxxx 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. root@xxxxx:~$ root@xxxxx:~$ pip3 list The program 'pip3' is currently not installed. You can install it by typing: sudo apt install python3-pip root@xxxxx:~$