【问题标题】:twistd in Twisted cant be run in windowtwisted in Twisted 不能在窗口中运行
【发布时间】:2011-03-27 22:05:18
【问题描述】:

在命令提示符中输入 >>twistd echobot.tac

Traceback (most recent call last):
  File "C:\Python26\Scripts\twistd.py", line 18, in ?
  from twisted.scripts.twistd import run
ImportError: No module named twisted.scripts.twistd

twistd 位于 C:\Python26\Scripts\twistd.py

#!c:\python26\python.exe

# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.


### Twisted Preamble
# This makes sure that users don't have to set up their environment
# specially in order to run these programs from bin/.
import sys, os, string
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
    sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),os.pardir, os.pardir)))
if hasattr(os, "getuid") and os.getuid() != 0:
    sys.path.insert(0, os.path.abspath(os.getcwd()))
### end of preamble


from twisted.scripts.twistd import run
run()

当我输入时

from twisted.scripts.twistd import run

在python中可以运行

【问题讨论】:

  • 这是什么版本的twisted,你是怎么安装的?
  • oww ...我已经忘记了...但是这个问题在窗口中...现在我使用 ubuntu ,像魅力一样工作
  • 某些版本的 Twisted 并没有在 Windows 上正确安装。我相信这已在当前版本中得到解决。

标签: python window twisted xmpp


【解决方案1】:

尝试设置路径..在cmd中是这样的:

set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib   

然后运行twistd

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-26
    • 1970-01-01
    • 2016-08-29
    相关资源
    最近更新 更多