zoukankan      html  css  js  c++  java
  • centos7 安装pip,yum

    pip是python中的一个包管理工具,可以对Python包的查找、下载、安装、卸载的作用。

    1
    2
    yum -y install epel-release
    yum -y install python-pip

    由于默认的pip源是国外的,所以下载速度会比较慢,python pip配置国内源

    1
    2
    3
    清华大学:https://pypi.tuna.tsinghua.edu.cn/simple
    阿里云:http://mirrors.aliyun.com/pypi/simple/
    豆瓣:http://pypi.douban.com/simple/

    方式一:临时使用国内pypi镜像安装

    1
    2
    pip install -i http://pypi.douban.com/simple/ numpy
    pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com  #此参数“--trusted-host”表示信任,如果上一个提示不受信任,就使用这个

    方式二:永久使用国内pypi镜像安装

    1、创建pip.conf文件

    1
    2
    3
    4
    5
    6
    7
    mkdir ~/.pip
    cd ~/.pip
    vi ~/.pip/pip.conf
    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    [install]
    trusted-host = https://pypi.tuna.tsinghua.edu.cn  # trusted-host 此参数是为了避免麻烦,否则使用的时候可能会提示不受信任

    2、升级pip的版本

    1
    pip install --upgrade pip

    3、查看已经安装的pip包

    1
    2
    3
    pip freeze or pip list
    //或 pip list
    更多命令可以执行pip --help

    4、pip相关的报错

    报错一:/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.5) or chardet (2.2.1) doesn't match a supported version!

    解决方法:

    1
    2
    3
    pip uninstall urllib3
    pip uninstall chardet
    pip install requests

    报错二:

    Python: error in moviepy setup command: ‘extras_require’ must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
    解决方法:setuptools版本太旧

    1
    pip install --upgrade setuptools
  • 相关阅读:
    织梦开发——相关阅读likeart应用
    织梦标签教程
    织梦专题调用代码
    HIT 2543 Stone IV
    POJ 3680 Intervals
    HIT 2739 The Chinese Postman Problem
    POJ 1273 Drainage Ditches
    POJ 2455 Secret Milking Machine
    SPOJ 371 Boxes
    HIT 2715 Matrix3
  • 原文地址:https://www.cnblogs.com/zhukaijian/p/13212283.html
Copyright © 2011-2022 走看看