Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Python gammu中使用setup.py_Python_Gammu - Fatal编程技术网

如何在Python gammu中使用setup.py

如何在Python gammu中使用setup.py,python,gammu,Python,Gammu,我下载gammu源文件。我的目标是能够在python程序中使用gammu模块。如何为python gammu运行setup.py安装程序。每次我尝试,我都会得到 running install running build running build_py running build_ext ERROR: Could not find pkg-config! 您首先需要安装PIP,在此之后安装python gammu(如果您使用linux),这比在其他操作系统上使用要好得多 图书馆很简单 #!/

我下载gammu源文件。我的目标是能够在python程序中使用gammu模块。如何为python gammu运行setup.py安装程序。每次我尝试,我都会得到

running install
running build
running build_py
running build_ext
ERROR: Could not find pkg-config!

您首先需要安装PIP,在此之后安装python gammu(如果您使用linux),这比在其他操作系统上使用要好得多

图书馆很简单

#!/usr/bin/env python
# Sample script to show how to send SMS

import gammu
import sys

# Create object for talking with phone
sm = gammu.StateMachine()

# Optionally load config file as defined by first parameter
if len(sys.argv) >= 2:
    # Read the configuration from given file
    sm.ReadConfig(Filename = sys.argv[1])
    # Remove file name from args list
    del sys.argv[1]
else:
    # Read the configuration (~/.gammurc)
    sm.ReadConfig()

# Check parameters
if len(sys.argv) != 2:
    print 'Usage: sendsms.py [configfile] RECIPIENT_NUMBER'
    sys.exit(1)

# Connect to the phone
sm.Init()

# Prepare message data
# We tell that we want to use first SMSC number stored in phone
message = {
    'Text': 'python-gammu testing message',
    'SMSC': {'Location': 1},
    'Number': sys.argv[1],
}

# Actually send the message
sm.SendSMS(message)
这里有更多信息的链接。


请记住,您可以使用控制台执行此操作,而不会出现任何问题。。。您必须记住的唯一一件事是在发送消息之前应用sudo命令,因为gammu在系统上安装为非root。

您如何运行它?您需要在命令行中安装
python setup.py
。感谢您的快速响应。我试过你的方法,同样的结果。我需要安装pkg config吗。我不知道这是怎么回事。部分问题似乎是因为我在windows上运行。“命令”中的getstatusoutput函数似乎对windows不友好。参考:我使用了链接中新的getstatusoutput()实现。现在我又犯了一个错误:对我来说,说“找不到vcvarsall.bat”,在linux上使用gammu更容易。我可以在debian linux中使用它(Ubuntu和Raspbian-用于raspberry pi)是一些windows二进制文件。只需安装一个前男友。