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

     

  • 相关阅读:
    资金流学习-成本分析
    解决root用户不能打开Chromium网页浏览器
    Kali Linux 2020.1乱码问题
    Kali Linux安装谷歌浏览器
    解决Kali Linux 2020.1乱码问题
    Kali Linux 2020.1a版本msfconsole启动失败问题
    Kali Linux发布2020.1a版本
    Kali Linux 2020.1快速修改root用户密码
    Kali Linux 2020.1安装桌面
    Kali Linux 2020.1修改系统语言
  • 原文地址:https://www.cnblogs.com/buxian/p/14346257.html
Copyright © 2011-2022 走看看