zoukankan      html  css  js  c++  java
  • Python离线安装第三方包

    Python离线安装第三方包

    1.通过pip下载安装包,然后在其他机器上安装

    python -m pip download  test==1.3.5  // 安装的库名为test,版本为1.3.5
    
    python -m pip install --no-index --find-links=./test/ test
    
    pip3 download -d /root/package/pip_package/ pymysql
    

    2.通过网站下载包

    下载网站:https://pypi.org/project/	
    
    安装whl包: pip install  **.whl(前提是要安装好pip和wheel)
    
    安装tar.gz包:cd到解压后路径,python setup.py install
    

    3.pip基本功能

    #安装
    pip install pandas      
    #卸载
    pip uninstall pandas
    
    #导出 freeze
    pip freeze > requirement.txt
    
    #显示 show/list
    pip show pandas  ##列出包的具体信息
    
    pip list         ##列出所有的包
    
    pip install package -i https://pypi.mirrors.ustc.edu.cn/simple/   ##使用中科大镜像源
    pip install -r requirement.txt  ##安装脚本里列出的库
    
    ## 离线下载安装包
    pip download -d ./path pyinstaller -i https://pypi.mirrors.ustc.edu.cn/simple/
    说明:
    	-d ./path 是将下载的文件存放到当前目录下的path文件夹里面
    	-i url 是从中科大镜像源下载文件
    ## 离线安装
    pip install -r requirement.txt  ## 生成requirement.txt
    cd .\Desktop\path     ##先进入这个文件夹内
    pip install -r requirement.txt    ##按照脚本内安装包的顺序安装库
    

    4.linux离线安装pip

    4.1 先安装setuptools

    (1)下载setuptools包

    wget https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz
    
    

    (2)解压setuptools包

    # tar zxvf setuptools-2.0.tar.gz
    # cd setuptools-2.0
    

    (3)编译setuptools

    # python setup.py build
    

    (4)开始执行setuptools安装

    python setup.py install
    
    4.2 安装pip

    (1)下载安装包

    wget https://files.pythonhosted.org/packages/e5/8f/3fc66461992dc9e9fcf5e005687d5f676729172dda640df2fd8b597a6da7/pip-9.0.2.tar.gz
    

    (2.)安装

    python setup.py install
    pip -v
    

    (3.)查看支持的版本

    import pip; print(pip.pep425tags.get_supported())
    
    [('cp27', 'cp27mu', 'manylinux1_x86_64'), ('cp27', 'cp27mu', 'linux_x86_64'), ('cp27', 'none', 'manylinux1_x86_64'), ('cp27', 'none', 'linux_x86_64'), ('py2', 'none', 'manylinux1_x86_64'), ('py2', 'none', 'linux_x86_64'), ('cp27', 'none', 'any'), ('cp2', 'none', 'any'), ('py27', 'none', 'any'), ('py2', 'none', 'any'), ('py26', 'none', 'any'), ('py25', 'none', 'any'), ('py24', 'none', 'any'), ('py23', 'none', 'any'), ('py22', 'none', 'any'), ('py21', 'none', 'any'), ('py20', 'none', 'any')]
    

    相关链接

    https://blog.csdn.net/LeechengLove/article/details/80090609

    https://zhuanlan.zhihu.com/p/351494670

  • 相关阅读:
    jQuery的动画效果
    jQuery的event事件
    设计模式 命令行模式
    桥接模式
    享元模式
    代理模式
    门面模式
    代理模式
    python基础-abstractmethod、__属性、property、setter、deleter、classmethod、staticmethod
    库存负数
  • 原文地址:https://www.cnblogs.com/tomtellyou/p/15396641.html
Copyright © 2011-2022 走看看