首页 > 代码库 > Linux离线安装pip和numpy

Linux离线安装pip和numpy

首先说明一下pip在线安装程序会发生什么

例如:

  运行pip install numpy

  1、pip会先下载与自己机器匹配的wheel安装包

    我的是numpy-1.12.1-cp27-cp27mu-manylinux1_x86_64.whl

  2、pip会运行如下命令来安装wheel安装包

    pip install numpy-1.12.1-cp27-cp27mu-manylinux1_x86_64.whl

  3、上面的pip命令会调用wheel命令来安装wheel安装包

    wheel unpack numpy-1.12.1-cp27-cp27mu-manylinux1_x86_64.whl

    cd numpy-1.12.1

    wheel install

很多情况下我们需要在局域网安装软件,那么可事先下载好这些安装包,然后手动安装

 

一、安装wheel

  1.1下载解压压缩包

  wget https://pypi.python.org/packages/a7/37/947b4329c4a3c72093b6c8e9b4be8c7f10c32dbb78848d3a234ce01c059d/wheel-0.30.0a0.tar.gz#md5=aa1145d48e4da2f9415eac2d51468a83

  tar -zxvf wheel-0.30.0a0.tar.gz

  cd wheel-0.30.0a0

  1.2安装wheel

  python setup.py build

  python setup.py install

二、安装pip(与安装wheel类似)

  1.1下载解压压缩包

  wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9

  tar -zxvf pip-9.0.1.tar.gz

  cd pip-9.0.1  #会发现当前目录下有个setup.py

  1.2安装pip

  python setup.py build

  python setup.py install

三、安装numpy

  pip list 查看是否已经numpy历史版本,可以用pip uninstall numpy卸载干净,然后再安装最新版本

  1.1下载解压压缩包

  wget https://pypi.python.org/packages/f9/d5/f24f86b51298f171826a398efdd64b5214b687a28a2f05ff736b1505b1b2/numpy-1.12.1-cp27-cp27mu-manylinux1_x86_64.whl#md5=471f740f61f7fba1a1a1e526bf710c49

  1.2安装numpy

  pip install numpy-1.12.1-cp27-cp27mu-manylinux1_x86_64.whl

  或者用wheel先解压再安装也行

Linux离线安装pip和numpy