zoukankan      html  css  js  c++  java
  • 通过setup.py安装项目dependencies

    一、使用方法

    • 安装命令   $ pip install  -e  <option>  

    • setup.py

    二、具体介绍

    • pip intall -e

    • 举例一个setup.py

    $ pip intall -e ".[train]"

    from setuptools import setup, find_packages
    import setuptools.command.develop
    import setuptools.command.build_py
    import os
    import subprocess
    
    version = '0.0.1'
    
    # Adapted from https://github.com/pytorch/pytorch
    cwd = os.path.dirname(os.path.abspath(__file__))
    if os.getenv('TACOTRON_BUILD_VERSION'):
        version = os.getenv('TACOTRON_BUILD_VERSION')
    else:
        try:
            sha = subprocess.check_output(
                ['git', 'rev-parse', 'HEAD'], cwd=cwd).decode('ascii').strip()
            version += '+' + sha[:7]
        except subprocess.CalledProcessError:
            pass
    
    
    class build_py(setuptools.command.build_py.build_py):
    
        def run(self):
            self.create_version_file()
            setuptools.command.build_py.build_py.run(self)
    
        @staticmethod
        def create_version_file():
            global version, cwd
            print('-- Building version ' + version)
            version_path = os.path.join(cwd, 'deepvoice3_pytorch', 'version.py')
            with open(version_path, 'w') as f:
                f.write("__version__ = '{}'
    ".format(version))
    
    
    class develop(setuptools.command.develop.develop):
    
        def run(self):
            build_py.create_version_file()
            setuptools.command.develop.develop.run(self)
    
    
    setup(name='deepvoice3_pytorch',
          version=version,
          description='PyTorch implementation of Tacotron speech synthesis model.',
          packages=find_packages(),
          cmdclass={
              'build_py': build_py,
              'develop': develop,
          },
          install_requires=[
              "numpy",
              "scipy",
              "unidecode",
              "inflect",
              "librosa",
              "numba",
              "lws <= 1.0",
          ],
          extras_require={
              "train": [
                  "docopt",
                  "tqdm",
                  "tensorboardX",
                  "nnmnkwii >= 0.0.9",
                  "nltk",
              ],
              "test": [
                  "nose",
              ],
              "jp": [
                  "jaconv",
                  "mecab-python3",
              ],
          })
    

      

  • 相关阅读:
    ASP.NET MVC 让@Html.DropDownList显示默认值
    ASP.NET MVC View向Controller提交数据
    ASP.NET MVC Controller向View传值的几种方式
    ASP.NET MVC3中Controller与View之间的数据传递总结
    net MVC中的模型绑定、验证以及ModelState
    30分钟LINQ教程
    使用Html.BeginForm来提交表单
    @Html.DropDownList
    uni-app页面导航栏透明背景
    nom install 报错
  • 原文地址:https://www.cnblogs.com/eniac1946/p/9213231.html
Copyright © 2011-2022 走看看