zoukankan      html  css  js  c++  java
  • pip下载已安装模块为.whl文件,离线安装到新机

    (pip版本:20.+,python==3.7.6)

    1、下载已安装模块为.whl或其他形式:

    alarm_packages文件夹是存放打包好的whl文件的,里面要放一个setup.py文件,不然会报错,内容如下:

    import sys
    import setuptools
    
    
    long_description = '''
    Texar is an open-source toolkit based on TensorFlow,
    aiming to support a broad set of machine learning especially text generation
    tasks, such as machine translation, dialog, summarization, content manipulation,
    language modeling, and so on.
    Texar is designed for both researchers and practitioners for fast prototyping
    and experimentation. Checkout https://github.com/asyml/texar-pytorch for the
    PyTorch version which has the same functionalities and (mostly) the same
    interfaces.
    '''
    
    if sys.version_info < (3, 6):
        sys.exit('Python>=3.6 is required by Texar.')
    
    setuptools.setup(
        name="texar",
        version="0.2.4",
        url="https://github.com/asyml/texar",
    
        description="Toolkit for Machine Learning and Text Generation",
        long_description=long_description,
        license='Apache License Version 2.0',
    
        packages=setuptools.find_packages(),
        platforms='any',
    
        install_requires=[
            'regex>=2018.01.10',
            'numpy<1.17.0',
            'pathlib>=1.0',
            'pyyaml',
            'requests',
            'funcsigs>=1.0.2',
            'sentencepiece>=0.1.8',
            'packaging'
        ],
        extras_require={
            'tensorflow-cpu': [
                'tensorflow>=1.10.0,<2.0',
                'tensorflow-probability>=0.3.0,<0.8.0'
            ],
            'tensorflow-gpu': [
                'tensorflow-gpu>=1.10.0,<2.0',
                'tensorflow-probability>=0.3.0,<0.8.0'
            ]
        },
        package_data={
            "texar": [
                "../bin/utils/multi-bleu.perl",
            ]
        },
        classifiers=[
            'Intended Audience :: Developers',
            'Intended Audience :: Education',
            'Intended Audience :: Science/Research',
            'Operating System :: OS Independent',
            'Programming Language :: Python',
            'Programming Language :: Python :: 3.6',
            'Programming Language :: Python :: 3.7',
        ],
    )

    在conda或者python环境中的Scrips文件夹下进入cmd(我的是anaconda3环境),

    pip freeze >requirements.txt
    pip download E:Anaconda3envsalarm0128alarm_packages -r requirements.txt -d E:Anaconda3envsalarm0128alarm_packages

    2、在离线机器上安装打包好的模块

    拷贝我们的alarm_packages文件夹到离线机器上(推荐英文路径,与Scripts文件夹同级);

    requirements.txt文件放在pip.exe目录下,也就是Scripts文件夹下。

    在离线机器的Scripts文件夹下进入cmd

    pip install --no-index --find-links=E:Anaconda3envspy37alarm_packages -r requirements.txt

    稍等片刻,新世界马上打开》》》》》

    .

    .

    参考网址:断网环境下利用pip安装Python离线安装包 - Michael翔 - 博客园 (cnblogs.com)

    pip install - pip documentation v21.0 (pypa.io)

    texar/setup.py at master · asyml/texar · GitHub

     

  • 相关阅读:
    函数中,易遗忘记载
    常用函数源码
    装饰器之自我理解
    函数名、闭包及迭代器
    函数2
    trap(陷井)
    文件操作
    搭建Pxe引导RamOS Linux内存系统
    X86服务器BMC基板管理控制器介绍
    Linux操作系统自动部署--镜像格式qcow2
  • 原文地址:https://www.cnblogs.com/buxian/p/14346257.html
Copyright © 2011-2022 走看看