ubuntu 安装librosa的时候出现No matching distribution found for pytest-runner

本文详细记录了在安装librosa过程中遇到的错误及解决方案,主要错误为pytest-runner未找到匹配版本,通过单独安装pytest-runner后成功安装librosa。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天在安装librosa的时候出现了下面的错误:

wugaosheng@s206:~$ pip3 install librosa
Collecting librosa
  Downloading http://mirrors.aliyun.com/pypi/packages/77/b5/1817862d64a7c231afd15419d8418ae1f000742cac275e85c74b219cbccb/librosa-0.7.2.tar.gz (1.6MB)
    100% |████████████████████████████████| 1.6MB 12.0MB/s
Collecting audioread>=2.0.0 (from librosa)
  Downloading http://mirrors.aliyun.com/pypi/packages/2e/0b/940ea7861e0e9049f09dcfd72a90c9ae55f697c17c299a323f0148f913d2/audioread-2.1.8.tar.gz
    Complete output from command python setup.py egg_info:
      Could not find a version that satisfies the requirement pytest-runner (from versions: )
    No matching distribution found for pytest-runner
    Traceback (most recent call last):
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpg2yxsb59', '--quiet', 'pytest-runner']' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-wobk5glq/audioread/setup.py", line 58, in <module>
        'Programming Language :: Python :: 3.6',
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 143, in setup
        _install_setup_requires(attrs)
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 783, in resolve
        replace_conflicting=replace_conflicting
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1066, in best_match
        return self.obtain(req, installer)
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1078, in obtain
        return installer(requirement)
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/home/wugaosheng/.local/lib/python3.6/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpg2yxsb59', '--quiet', 'pytest-runner']' returned non-zero exit status 1.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wobk5glq/audioread/

解决方法

pip3 install pytest-runner
pip3 install librosa

参考文献

[1].pytest-runner 5.2. https://pypi.org/project/pytest-runner/

<think>好的,我需要帮助用户解决在安装potrace时遇到的'no matching distribution found for potrace'错误。首先,我要回忆一下常见的pip安装错误的原因。根据用户提到的其他引用,比如引用[4]中提到的pytest-runner问题,可能和包名称是否正确、包是否存在、Python版本或系统环境有关。 首先,我应该检查用户是否正确输入了包名。potrace可能是一个需要编译的工具,而pip上可能没有对应的wheel。比如,potrace本身是一个图形工具,可能不是纯Python包,用户可能混淆了安装方式。这时候需要确认用户是否应该使用系统包管理器安装,比如在Ubuntu上用apt-get安装,而不是pip。 接着,考虑是否存在拼写错误。用户输入的是不是正确的包名?比如,有时候包名可能有大小写或者下划线的差异。比如,检查PyPI上是否存在potrace这个包。快速搜索PyPI发现,确实没有叫potrace的包,而有一个叫pypotrace的库,但可能需要系统安装potrace的开发库。 另外,可能用户的环境不满足要求,比如Python版本太旧,或者操作系统不支持。比如,某些包只支持Python3.x,而用户在用Python2.7。或者包可能只发布在特定平台上,比如Windows的二进制包,而用户是在Linux上安装。 解决方案可能包括:建议用户使用系统包管理器安装potrace,例如在Ubuntu上运行sudo apt-get install potrace。然后,如果需要Python绑定,可能需要安装pypotrace,但这时候需要先安装系统级的potrace库,再通过pip安装pypotrace。此外,可能用户需要安装依赖项,如开发文件(libpotrace-dev)。 同时,检查pip是否需要升级,如引用[1]提到的,旧版pip可能无法找到某些包。所以建议用户先升级pip,再尝试安装。如果问题依旧,可能需要确认包是否存在,或者是否有其他安装方式。 另外,用户提到的另一个错误是关于npm和vue的,这可能暗示用户的环境配置有问题,比如权限问题或者依赖缺失,但这里可能不相关。不过,可以考虑建议用户检查虚拟环境是否正确激活,或者是否存在网络问题导致pip无法访问PyPI。 总结可能的解决步骤: 1. 确认包名称是否正确,尝试正确的包名如pypotrace。 2. 使用系统包管理器安装potrace,再安装Python绑定。 3. 升级pip到最新版本。 4. 检查Python版本是否符合要求。 5. 安装必要的系统依赖项,如编译工具或开发库。 6. 使用虚拟环境避免权限问题。 需要将这些步骤以清晰的方式呈现给用户,并引用相关的参考资料,如引用[4]中提到的处理类似问题的方法,可能需要安装系统依赖或使用正确的包名。</think>### 解决 `no matching distribution found for potrace` 的步骤 1. **确认包名称是否正确** - `potrace` 本身是一个开源的矢量图形工具,其核心是 C 语言编写的命令行程序,**并非纯 Python 包**。因此,直接通过 `pip install potrace` 安装会失败。 - 正确的 Python 绑定包名为 `pypotrace`,但需要先安装系统级的 `potrace` 库。 2. **通过系统包管理器安装 `potrace`** - **Ubuntu/Debian**: ```bash sudo apt-get update sudo apt-get install potrace libpotrace-dev # 安装核心工具和开发文件 ``` - **macOS (Homebrew)**: ```bash brew install potrace ``` - **Windows**: 从 [Potrace 官网](http://potrace.sourceforge.net/) 下载预编译的二进制文件并配置环境变量[^4]。 3. **安装 Python 绑定包 `pypotrace`** 安装系统级依赖后,再通过 pip 安装 Python 封装: ```bash pip install pypotrace ``` 4. **升级 pip 并检查 Python 版本** - 旧版 pip 可能导致包搜索失败: ```bash pip install --upgrade pip ``` - 确保 Python 版本 ≥3.6(`pypotrace` 要求 Python 3+)。 5. **使用虚拟环境(可选)** 避免全局安装冲突: ```bash python -m venv myenv source myenv/bin/activate # Linux/macOS myenv\Scripts\activate # Windows pip install pypotrace ``` --- ### 常见问题补充 - **若报错提示缺少 `numpy` 或 `Cython`**: 先安装编译依赖: ```bash pip install numpy Cython ``` 再重试 `pip install pypotrace`。 - **Windows 环境问题**: 需安装 Visual Studio Build Tools 或 MinGW 以编译 C 扩展。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

农民小飞侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值