'twistd' is not a recognized internal or external command

霸气de小男生 提交于 2019-12-06 09:12:15

You need to set the %PATHEXT% environment variable to include .py, as well as %PATH% including the path to twistd. Your most-recently-installed version of Python should then automatically launch it, assuming the filetype association was set correctly by the installer.

Create a twistd.bat and save it under your Scripts directory; if you're using virtualenv, the exact path is: <virtualenv_root_dir>\Scripts\twistd.bat

Edit twistd.bat and put the ff:

@echo off
python %~dp0twistd.py %*

Assumptions:

  • There should be a <virtualenv_root_dir>\Scripts\twistd.py after installing Twisted in your virtualenv.
  • <virtualenv_root_dir>\Scripts is in your %PATH%

Then after activating your virtualenv, you should be able to run twistd directly, e.g.

twistd web --path . --port 8080

I myself uses this approach in a Windows XP machine.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!