简体   繁体   English

在 Mac OS X 上使用 Conda 安装 pyzbar 时出错

[英]Error installing pyzbar with Conda on Mac OS X

I am attempting to convert a project from a Python 3 venv to Conda.我正在尝试将项目从 Python 3 venv 转换为 Conda。 However, it doesn't work with Conda, apparently because there is no repository that supports macOS.但是,它不适用于 Conda,显然是因为没有支持 macOS 的存储库。

This is disappointing because using brew and pip to install zbar and pyzbar in the original project works fine.这令人失望,因为在原始项目中使用brewpip安装zbarpyzbar工作正常。 So clearly the files exist but are not available through Conda repos.很明显,这些文件存在,但不能通过 Conda repos 获得。 Am I missing a repo somewhere?我在某处错过了回购吗? If not, is there a way to crowbar the packages downloaded with pip and brew into a Conda environment?如果没有,有没有办法撬开用pip下载的包并冲入brew环境?

Here's what I've tried.这是我尝试过的。

I see instructions which say to use conda install -c lightsource2-tag pyzbar .看到说明说要使用conda install -c lightsource2-tag pyzbar However Conda fails to resolve (complete error message at the bottom of this note).但是,Conda 无法解决(本说明底部的完整错误消息)。

This seems consistent with the results of searching https://anaconda.org/search?q=pyzbar .这似乎与搜索https://anaconda.org/search?q=pyzbar的结果一致。 The only repos listed are for Linux and win32.列出的唯一存储库是 Linux 和 win32。

(NewUI_conda) BlueMorph: /Users/Wes 12:16
516$ conda install -c lightsource2-tag pyzbar
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - pyzbar

Current channels:

  - https://conda.anaconda.org/lightsource2-tag/osx-64
  - https://conda.anaconda.org/lightsource2-tag/noarch
  - https://conda.anaconda.org/conda-forge/osx-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

Yes, it looks like pyzbar is not available through Anaconda Cloud channels for osx-64 platform.是的,看起来pyzbar无法通过osx-64平台的 Anaconda 云通道获得。 Instead, one can (cautiously) mix PyPI and Conda packages.相反,可以(谨慎地)混合使用 PyPI 和 Conda 包。 For example, a basic YAML definition would be something like:例如,基本的 YAML 定义类似于:

zbar_env.yaml zbar_env.yaml

name: zbar_env
channels:
 - conda-forge
 - defaults
dependencies:
 - python=3
 - zbar
 - pip
 - pip:
   - pyzbar

which can be instantiated with:可以通过以下方式实例化:

conda env create -f zbar_env.yaml

As per the recommendations for mixing PyPI and Conda , place all requirements in this YAML file from the start.根据混合 PyPI 和 Conda 的建议,从一开始就将所有要求放在此 YAML 文件中。 If you need to add something new, edit the YAML and recreate the env.如果您需要添加新内容,请编辑 YAML 并重新创建环境。


Alternatively, you could switch to zbarlight , which is available through Conda Forge and appears to be consistently maintained.或者,您可以切换到zbarlight它可通过 Conda Forge 获得,并且似乎得到了一致的维护。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM