安装Python第三方库方法总结

方法一

  • 使用pip命令(在命令行下执行)

  1. 使用如下命令可以查看pip帮助

    $ pip --help
    Usage:
      pip <command> [options]
    Commands:
      install                     Install packages.
      download                    Download packages.
      uninstall                   Uninstall packages.
      freeze                      Output installed packages in requirements format.
      list                        List installed packages.
      show                        Show information about installed packages.
      check                       Verify installed packages have compatible dependencies.
      config                      Manage local and global configuration.
      search                      Search PyPI for packages.
      wheel                       Build wheels from your requirements.
      hash                        Compute hashes of package archives.
      completion                  A helper command used for command completion.
      help                        Show help for commands.
    General Options:
      -h, --help                  Show help.
      --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
      -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
      -V, --version               Show version and exit.
  2. 安装指定的第三方库

    $ pip install <第三方库名>

  3. 使用 -U标签更新已安装的指定第三方库

    $ pip install -U <第三方库名>

  4. 卸载指定的第三方库

    $ pip uninstall <第三方库名>

  5. 下载但并不安装第三方库

    $ pip download <第三方库名>

  6. 列出某个第三方库的详细信息

    $ pip show <第三方库名>

  7. 搜索第三方库

    $ pip search <关键字>
    8.列出系统已经安装的库
    $ pip list

方法二

  • 集成安装方法

  • Anaconda http://www.continuum.io
  • 支持近800个第三方库
  • 包含多个主流工具
    -适合数据计算领域开发

方法三

  • 文件安装方法

    为什么有的第三方库可以下载但不能安装?

  • 某些第三方库下载后需要编译再安装
  • 如果操作系统没有编译环境,则能下载不能安装
  • 可以直接下载编译后的版本安装吗?
  • 可以!在UCI页面下载编译完成后的文件安装。
  • 结合你的本地环境,下载合适版本的第三方库,通过如下命令安装

    pip install <第三方库所在的路径>

猜你喜欢

转载自www.cnblogs.com/xucoding/p/9118106.html