【问题标题】:How to make conda-build work correctly and find the setup.py?如何使 conda-build 正常工作并找到 setup.py?
【发布时间】:2020-02-11 12:15:34
【问题描述】:

我正在尝试创建一个 anaconda python 包。我的meta.yaml 看起来像这样:

package:
  name: liveprint-lib
  version: "0.1.0"

build:
  number: 0

requirements:
  build:
    - pip
    - python=3.7
    - setuptools
  run:
    - python=3.7
    - numpy
    - opencv

about:
  home: https://github.com/monomonedula/liveprint
  license: Apache License 2.0
  license_file: LICENSE.txt
  summary: Python utility library for dynamic animations projections

build.sh:

$PYTHON setup.py install

文件夹结构:

.
├── bld.bat
├── build.sh
├── LICENSE.txt
├── liveprint
├── meta.yaml
├── README.md
├── resources
├── setup.py
└── test

我在运行conda build . 时遇到的错误如下:

/home/vhhl/programs/anaconda3/conda-bld/liveprint-lib_1581422598848/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/python: can't open file 'setup.py': [Errno 2] No such file or directory

我做错了什么?

【问题讨论】:

    标签: python anaconda conda conda-build


    【解决方案1】:

    您的meta.yaml 文件缺少source 部分。此外,通常最好将您的配方文件保存在它们自己的目录中,而不是放在顶级存储库中。我推荐以下:

    mkdir conda-recipe
    mv meta.yaml build.sh bld.bat conda-recipe
    

    然后,编辑 meta.yaml 以添加一个 source 部分,该部分指向您的存储库的顶级目录。

    package:
      name: liveprint-lib
      version: "0.1.0"
    
    source:
      # Relative path to the parent directory.
      path: ..
    
    build:
      number: 0
    
    requirements:
      build:
        - pip
        - python=3.7
        - setuptools
      run:
        - python=3.7
        - numpy
        - opencv
    

    那就试试吧:

    conda build conda-recipe
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-06
      • 1970-01-01
      • 1970-01-01
      • 2021-10-31
      • 1970-01-01
      • 2018-09-19
      • 2021-12-24
      • 2020-03-29
      相关资源
      最近更新 更多