相关疑难解决方法(0)

561
推荐指数
20
解决办法
24万
查看次数

检查Linux发行版名称

我必须从Python脚本中获取Linux发行版名称.dist平台模块中有一个方法:

import platform
platform.dist()
Run Code Online (Sandbox Code Playgroud)

但在我的Arch Linux下它返回:

>>> platform.dist()
('', '', '')
Run Code Online (Sandbox Code Playgroud)

为什么?我怎么能得到这个名字?

PS.我必须检查分发是否是基于Debian的.


更新:我在这里找到了Python站点,自2.6以来,dist()已被弃用.

>>> platform.linux_distribution()
('', '', '')
Run Code Online (Sandbox Code Playgroud)

python linux

29
推荐指数
5
解决办法
2万
查看次数

来自命令行的ms语音

有没有办法从命令行使用MS Speech实用程序?我可以在Mac上执行此操作,但在Windows XP上找不到任何对它的引用.

谢谢.

cmd text-to-speech

27
推荐指数
3
解决办法
6万
查看次数

BadPrototypeError:Objective-C需要1个参数,Python参数有2个参数

我正在使用python模块pyttsx进行文本到语音,当我运行代码时,我收到此错误:

     File "Practice_File.py", line 2, in <module>
     engine = pyttsx.init()
     File "/Library/Python/2.7/site-packages/pyttsx/__init__.py",
     line 39, in init
     eng = Engine(driverName, debug)
     File "/Library/Python/2.7/site-packages/pyttsx/engine.py", line
     45, in __init__
     self.proxy = driver.DriverProxy(weakref.proxy(self), driverName,
     debug)
     File "/Library/Python/2.7/site-packages/pyttsx/driver.py", line
     64, in __init__
     self._module = __import__(name, globals(), locals(), [driverName])
     File "/Library/Python/2.7/site-packages/pyttsx/drivers
     /nsss.py", line 26, in <module>
     class NSSpeechDriver(NSObject):
     objc.BadPrototypeError: Objective-C expects 1 arguments, Python
     argument has 2 arguments for <unbound selector initWithProxy of
     NSSpeechDriver at 0x107592e68>
Run Code Online (Sandbox Code Playgroud)

这是我的python代码:

    import pyttsx
    engine = pyttsx.init()
    engine.say('Good morning.')
    engine.runAndWait()
Run Code Online (Sandbox Code Playgroud)

有关如何解决此问题的任何想法?谢谢.

python pyttsx

6
推荐指数
0
解决办法
1708
查看次数