将python脚本从一台机器迁移到另一台机器会导致modu

2024-10-01 00:21:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在创建一个基于yowsup的Python项目。(可以在这里找到:https://github.com/jorgehortelano/yowsup-commandserver)其思想是使用WhatsApp执行命令。你知道吗

我在本地计算机(ubuntu14.04.4lts)上用Python编译过。它运行良好,我可以用WhatsApp与我的软件进行通信。它使用python2.7.6

现在我想用ubuntu15.10在Raspberry pi2上安装它。它使用python2.7.10。你知道吗

在Raspberry中用一个简单的git clone克隆存储库并尝试执行它会导致:

Traceback (most recent call last):
File "./yowsup-commandserver", line 358, in <module>
if not parser.process():
File "./yowsup-commandserver", line 239, in process
self.startCommandServer()
File "./yowsup-commandserver", line 299, in startCommandServer
stack = commandserver.YowsupCommandServerStack(credentials, allowed_users, not self.args["unmoxie"])
AttributeError: 'module' object has no attribute 'YowsupCommandServerStack'

我可以理解模块的定义可能不正确,因为我是python的初学者,但我无法理解为什么在我的桌面计算机中而不是在Raspberry Pi中正确执行。你知道吗

我不希望有人给我修,我只想了解为什么模块在从一台机器移到另一台机器时加载不正确。你知道吗


Tags: 模块inself计算机linenotprocessraspberry
1条回答
网友
1楼 · 发布于 2024-10-01 00:21:04

我认为您遇到了版本/依赖性问题。 使用virtualenv可以很容易地解决这个问题。 安装相同的Python版本,并将所有依赖项保持在一个要求.txt它应该在任何使用virtualenv Python而不是OS Python的机器上工作

相关问题 更多 >