小编chu*_*hts的帖子

如何在 ARM MacOS 机器上使用 Rosetta2 将 Python 作为 X86 运行

我有一个 python 应用程序,下游依赖于仅作为 X86 提供的动态库。

该应用程序在 X86 MacOS 计算机上运行,​​但在 ARM MacOS 计算机上运行失败,并显示ImportError.

我已经lipo -archs在库上运行过,它们x86_64只是。我在 virtualenv 中运行 Python,它是通用二进制文件x86_64 arm64。应用程序在安装时构建的中间目标文件也是通用二进制文件x86_64 arm64

我怀疑 Python 作为 ARM 应用程序本地运行,但由于依赖关系,我需要它作为 X86 应用程序运行。

是否有 MacOS 或 Rosetta2 选项或环境设置可供我使用来强制执行 X86 Python 二进制文件而不是 ARM 二进制文件?

python macos rosetta-2

7
推荐指数
2
解决办法
1万
查看次数

使用声明性命令创建 Kubernetes Pod 时出现 ErrImagePull:401 Unauthorized

我正在开展一个实验室,展示如何在 IBM Cloud 上设置 Kubernetes 和 CLI。

我有 Kubernetes 集群设置和容器注册表。我在 CLI 上登录到 IBM Cloud 和 Container Registry。镜像已创建并推送。

我可以使用带有命令式命令的图像创建一个 pod:

kubectl create -f hello-world-create.yaml
Run Code Online (Sandbox Code Playgroud)

文件yaml如下所示:

kubectl create -f hello-world-create.yaml
Run Code Online (Sandbox Code Playgroud)

但是当我尝试对运行的同一图像使用声明性命令时

kubectl apply -f hello-world-apply.yaml
Run Code Online (Sandbox Code Playgroud)

文件yaml的样子

apiVersion: v1
kind: Pod
metadata:
  name: hello-world
spec:
  containers:
  - name: hello-world
    image: us.icr.io/earlyprogramimages/hello-world:1
    ports:
    - containerPort: 80
  imagePullSecrets:
  - name: icr

Run Code Online (Sandbox Code Playgroud)

ErrImagePull我获取事件堆栈所在的每个 Pod的状态

Successfully assigned default/hello-world-6fd8bd67dc-79gbz to xx.xx.xx.xx
Pulling image "us.icr.io/earlyprogramimages/hello-world:1

Failed to pull image "us.icr.io/earlyprogramimages/hello-world:1": rpc error: code = …
Run Code Online (Sandbox Code Playgroud)

kubernetes ibm-cloud

4
推荐指数
1
解决办法
3万
查看次数

在SpringBoot中@JmsListener如何以及何时被调用?

我是 SpringBoot 的新手。尝试构建一个简单的非 Web 流程,在其中侦听 MQ 队列并处理收到的消息。我尝试了各种方法来在 SB 中实现此目的,但不幸的是我无法调用 @JmsListener 方法。也没有错误,过程只是等待。

所有 MQ 队列详细信息都在 application.properties 中

我确实验证了队列中有消息,并且可以使用旧的 MQ 接收器方式检索它们。

我想知道 @JmsListener Annotation 方法如何以及何时被调用?我确实尝试创建一个 JmsListenerContainerFactory 并将其包含在注释参数中,但没有什么区别。

类似的例子很少,看起来很简单,但我就是无法让它工作。任何建议表示赞赏。谢谢。

SpringBoot主类

@SpringBootApplication
@EnableJms
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
Run Code Online (Sandbox Code Playgroud)

MQListener 类

@Component
public class MQListener {
    @JmsListener(destination = "${mq.queueName}")
    public void receiveMessage(final Message message) throws JMSException{
        System.out.println("...Message Received...");
        String messageData = null;
        if(message instanceof TextMessage) {
            TextMessage textMessage = (TextMessage)message;
            messageData = textMessage.getText();
        }
    }
} …
Run Code Online (Sandbox Code Playgroud)

spring-jms spring-boot ibm-mq

4
推荐指数
1
解决办法
3万
查看次数