【问题标题】:macport : "Error: The 'list' command failed: The specified group 'python' does not exist." on MACmacport:“错误:'list' 命令失败:指定的组 'python' 不存在。”在 MAC 上
【发布时间】:2020-05-21 04:45:05
【问题描述】:

我在 macOS 上,我正在尝试使用 macport 在 python 上安装一个名为“obspy”的包。 我已经安装了 Xcode 和 macport,并尝试了下面的代码:

sudo port select python

然后返回错误信息:

screen shot of my terminal while entering the command

有没有办法“创建”或确保 macport 识别组“python”? (当然我有python,python的路径是/usr/bin/python

【问题讨论】:

标签: python macports


【解决方案1】:

来自手册页(man port):

对于给定的组,通过创建适当的符号选择一个版本作为默认版本 链接。例如,python 可能链接到 python2.6。可用的选择组是 安装为 ${prefix}/etc/select/ 的子目录,并且可以使用 --summary 列出。到 列出组中的可用版本,使用 --list。查看当前是哪个版本 为组选择,使用--show。要更改组的选定版本,请使用 --set。

      For example:

         port select --summary
         port select --show python
         port select --list python
         port select --set python python34

您可以通过以下方式找到所有现有组:

port select --summary

port select 用于选择 macports 的默认 python。 例如,如果您的前缀是/opt/local,那么默认的python 是/opt/local/bin/python,它只是一个指向python 版本的符号链接。


我想您正在尝试选择要使用的 python,然后安装 obspy。你真的不需要经历所有的麻烦,因为 macports 可以管理这一切。

您可以简单地执行以下步骤:

sudo port search obspy

你会得到类似的东西:

obspy_select @1.0 (python)
    Common files for selecting default ObsPy version

py-obspy @1.1.0_1 (python, science)
    Python framework for processing seismological data

py27-obspy @1.1.0_1 (python, science)
    Python framework for processing seismological data

py35-obspy @1.1.0_1 (python, science)
    Python framework for processing seismological data

py36-obspy @1.1.0_1 (python, science)
    Python framework for processing seismological data

py37-obspy @1.1.0_1 (python, science)
    Python framework for processing seismological data

Found 6 ports.

选择符合您需要的端口。

例如,

sudo port install py-obspy

由于 python 是它的依赖项,macports 将管理安装它。 安装py-obspy后,启动macports的python:

(我假设你的前缀/opt/local

/opt/local/bin/python

然后尝试导入obspy

如果您不确定您的前缀,请通过以下方式检查:

echo "${"$(which port)"%/bin/port}"

【讨论】:

    猜你喜欢
    • 2017-05-21
    • 1970-01-01
    • 2020-03-31
    • 2019-07-03
    • 1970-01-01
    • 1970-01-01
    • 2021-06-14
    • 1970-01-01
    • 2018-05-16
    相关资源
    最近更新 更多