pip 与 pip3 安装

pip 与 pip3 安装

1. Ubuntu

Python 2:

sudo apt install python-pip

Python 3:

sudo apt install python3-venv python3-pip

2. Python 2 - pip - sudo apt install python-pip

2.1 pip

deepnorth@deepnorth-amax:~$ pip
The program 'pip' is currently not installed. You can install it by typing:
sudo apt install python-pip
deepnorth@deepnorth-amax:~$

2.2 sudo apt install python-pip

deepnorth@deepnorth-amax:~$ sudo apt install python-pip
[sudo] password for deepnorth:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libpython3-dev libpython3.5-dev python3-dev python3-wheel python3.5-dev
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  python-pip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 144 kB of archives.
After this operation, 635 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-pip all 8.1.1-2ubuntu0.4 [144 kB]
Fetched 144 kB in 1min 38s (1,458 B/s)
Selecting previously unselected package python-pip.
(Reading database ... 217596 files and directories currently installed.)
Preparing to unpack .../python-pip_8.1.1-2ubuntu0.4_all.deb ...
Unpacking python-pip (8.1.1-2ubuntu0.4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python-pip (8.1.1-2ubuntu0.4) ...
deepnorth@deepnorth-amax:~$

2.3 pip --version

deepnorth@deepnorth-amax:~$ pip --version
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
deepnorth@deepnorth-amax:~$

2.4 sudo pip install numpy==1.16.4

deepnorth@deepnorth-amax:~/software$ sudo pip install numpy==1.16.4
......
deepnorth@deepnorth-amax:~/software$

2.5 print(numpy.get_include())

deepnorth@deepnorth-amax:~$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> print(numpy.get_include())
/usr/local/lib/python2.7/dist-packages/numpy/core/include
>>> exit()
deepnorth@deepnorth-amax:~$

3. Python 3 - pip3 - sudo apt install python3-pip

3.1 pip3

deepnorth@deepnorth-amax:~$ pip3
The program 'pip3' is currently not installed. You can install it by typing:
sudo apt install python3-pip
deepnorth@deepnorth-amax:~$

3.2 sudo apt install python3-pip

deepnorth@deepnorth-amax:~$ sudo apt install python3-pip
[sudo] password for deepnorth:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  python3-pip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 109 kB of archives.
After this operation, 569 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python3-pip all 8.1.1-2ubuntu0.4 [109 kB]
Fetched 109 kB in 1min 22s (1,324 B/s)
Selecting previously unselected package python3-pip.
(Reading database ... 217700 files and directories currently installed.)
Preparing to unpack .../python3-pip_8.1.1-2ubuntu0.4_all.deb ...
Unpacking python3-pip (8.1.1-2ubuntu0.4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python3-pip (8.1.1-2ubuntu0.4) ...
deepnorth@deepnorth-amax:~$

3.3 pip3 --version

deepnorth@deepnorth-amax:~$ pip3 --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
deepnorth@deepnorth-amax:~$

3.4 sudo pip3 install numpy==1.16.4

deepnorth@deepnorth-amax:~$ sudo pip3 install numpy==1.16.4
The directory '/home/deepnorth/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/deepnorth/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting numpy==1.16.4
  Downloading https://files.pythonhosted.org/packages/bb/ef/d5a21cbc094d3f4d5b5336494dbcc9550b70c766a8345513c7c24ed18418/numpy-1.16.4-cp35-cp35m-manylinux1_x86_64.whl (17.2MB)
    100% |████████████████████████████████| 17.2MB 11kB/s
Installing collected packages: numpy
Successfully installed numpy-1.16.4
You are using pip version 8.1.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
deepnorth@deepnorth-amax:~$

3.5 print(numpy.get_include())

deepnorth@deepnorth-amax:~$ python3
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> print(numpy.get_include())
/usr/local/lib/python3.5/dist-packages/numpy/core/include
>>> exit()
deepnorth@deepnorth-amax:~$

References

Python Package Index,PyPI
pip installs packages,pip

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Yongqiang Cheng

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

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

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

打赏作者

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

抵扣说明:

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

余额充值