• 安装pip


      使用pip可以很方便地安装所需的python包,本篇仅简单记录下pip的安装,以备日后查阅。

    1、下载get-pip.py

      get-pip.py下载地址:https://bootstrap.pypa.io/get-pip.py

    2、安装

      我是将这个脚本放在Python的安装路径的Scripts目录下:

    C:Python27Scripts>python get-pip.py
    Collecting pip
      Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
    Collecting wheel
      Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl (41kB)
        100% |████████████████████████████████| 51kB 624kB/s
    Installing collected packages: pip, wheel
      Found existing installation: pip 9.0.3
        Uninstalling pip-9.0.3:
          Successfully uninstalled pip-9.0.3
      The script wheel.exe is installed in 'C:Python27Scripts' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
    Successfully installed pip-18.0 wheel-0.31.1

      默认会在当前目录生成几个pip*.exe,也即是:C:Python27Scripts

     C:Python27Scripts 的目录
    
    2018/08/18  11:13    <DIR>          .
    2018/08/18  11:13    <DIR>          ..
    2018/08/18  11:13           102,752 chardetect.exe
    2018/07/27  13:17            98,153 easy_install-2.7.exe
    2018/07/27  13:17            98,153 easy_install.exe
    2018/08/10  15:22         1,642,522 get-pip.py
    2018/08/10  15:23           102,743 pip.exe
    2018/08/10  15:23           102,743 pip2.7.exe
    2018/08/10  15:23           102,743 pip2.exe
    2018/08/10  15:23           102,740 wheel.exe
                   8 个文件      2,352,549 字节
                   2 个目录 183,052,087,296 可用字节

      需要将pip的文件的路径加到环境变量中,这样在其他目录下也能使用pip命令:

      步骤:右键我的电脑->属性->高级系统设置->高级选项卡->环境变量->系统变量->Path->加入pip所在路径:C:Python27Scripts,

           

    3、安装python包

      上面安装好pip之后,就可以使用pip install命令安装我们所需要的包了。

    C:Python27Scripts>pip install dnspython gevent
    Collecting dnspython
      Downloading https://files.pythonhosted.org/packages/a6/72/209e18bdfedfd78c6994e9ec96981624a5ad7738524dd474237268422cb8/dnspython-1.15.0-py2.py3-none-any.whl (177kB)
        100% |████████████████████████████████| 184kB 758kB/s
    Collecting gevent
      Downloading https://files.pythonhosted.org/packages/f1/54/61ae4d9e1078c52047fa625cf39c8197517baa45599174e5d3ed91105b8a/gevent-1.3.5-cp27-cp27m-win_amd64.whl (2.1MB)
        100% |████████████████████████████████| 2.1MB 3.2MB/s
    Collecting cffi>=1.11.5; sys_platform == "win32" and platform_python_implementation == "CPython" (from gevent)
      Downloading https://files.pythonhosted.org/packages/89/12/684bad296567b9300c7ac82a4f635b489ed589fa7c0bb2042208e3c020e3/cffi-1.11.5-cp27-cp27m-win_amd64.whl (163kB)
        100% |████████████████████████████████| 163kB 957kB/s
    Collecting greenlet>=0.4.13; platform_python_implementation == "CPython" (from gevent)
      Downloading https://files.pythonhosted.org/packages/ad/23/1a05344026d49ba6a685ebad19933cdae0ef133038da5a941bfe2b215a6d/greenlet-0.4.14-cp27-cp27m-win_amd64.whl
    Collecting pycparser (from cffi>=1.11.5; sys_platform == "win32" and platform_python_implementation == "CPython"->gevent)
      Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
        100% |████████████████████████████████| 256kB 1.3MB/s
    Building wheels for collected packages: pycparser
      Running setup.py bdist_wheel for pycparser ... done
      Stored in directory: C:UsersliuzhenAppDataLocalpipCachewheelsc0a1275ba234bd77ea5a290cbf6d675259ec52293193467a12ef1f46
    Successfully built pycparser
    Installing collected packages: dnspython, pycparser, cffi, greenlet, gevent
    Successfully installed cffi-1.11.5 dnspython-1.15.0 gevent-1.3.5 greenlet-0.4.14 pycparser-2.18
  • 相关阅读:
    poj2392 Space Elevator(多重背包问题)
    poj1703 Find them, Catch them(并查集的应用)
    HDU 1867 A + B for you again(KMP算法的应用)
    HDU 1358 Period(kmp简单解决)
    nyoj 460 项链 (区间dp)
    Python内置函数(9)——callable--转载
    Python的hasattr() getattr() setattr() 函数使用方法详解--转载
    python assert 断言详细用法格式
    sam文件格式
    Linux中重定向--转载
  • 原文地址:https://www.cnblogs.com/Hi-blog/p/9455328.html
Copyright © 2020-2023  润新知