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

     

  • 相关阅读:
    如何在Windows 7平台搭建Android Cocos2d-x3.2alpha0开发环境
    boost::unordered_map分析和使用(转)
    #、##、__VA_ARGS__和##__VA_ARGS__的作用(转)
    C++ explicit关键字详解(转)
    C++11的auto关键字
    Nagios监控系统
    CentOS6.5安装oracle11
    Centos7系统中Mysql登录忘记root密码
    在Centos7系统上查看Mysql版本的方法
    忘记Redhat7root密码
  • 原文地址:https://www.cnblogs.com/buxian/p/14346257.html
Copyright © 2011-2022 走看看