记不清是第几次碰到这个问题了,终于决定纪录一下,报错如下:
[root@iZ25q6tzh75Z services]# ladon-ctl testserve uranium238services.py -p 8080
/usr/local/bin/ladon-ctl: line 3: from: command not found
/usr/local/bin/ladon-ctl: line 4: from: command not found
/usr/local/bin/ladon-ctl: line 5: import: command not found
/usr/local/bin/ladon-ctl: line 7: commands: command not found
/usr/local/bin/ladon-ctl: line 8: testserve:: command not found
/usr/local/bin/ladon-ctl: line 9: desc:: command not found
/usr/local/bin/ladon-ctl: line 10: options:: command not found
/usr/local/bin/ladon-ctl: line 11: -p:: command not found
/usr/local/bin/ladon-ctl: line 12: help:: command not found
/usr/local/bin/ladon-ctl: line 13: metavar:: command not found
/usr/local/bin/ladon-ctl: line 14: dest:: command not found
/usr/local/bin/ladon-ctl: line 15: type:: command not found
/usr/local/bin/ladon-ctl: line 16: default:: command not found
/usr/local/bin/ladon-ctl: line 17: },: command not found
/usr/local/bin/ladon-ctl: line 18: -v:: command not found
/usr/local/bin/ladon-ctl: line 19: help:: command not found
/usr/local/bin/ladon-ctl: line 20: metavar:: command not found
/usr/local/bin/ladon-ctl: line 21: dest:: command not found
/usr/local/bin/ladon-ctl: line 22: type:: command not found
/usr/local/bin/ladon-ctl: line 23: default:: command not found
/usr/local/bin/ladon-ctl: line 24: syntax error near unexpected token `}'
/usr/local/bin/ladon-ctl: line 24: ` }'
[root@iZ25q6tzh75Z services]#
这个问题是ladon-ctl没有声明解释器,在头上加个
#!/usr/local/bin/python3
根据自己的python解释器进行具体调整
上面的错误修正完之后,还有一个:
ptions: {'verbose': False, 'port': '8080'}
Modules: uranium238services.py
Traceback (most recent call last):
File "/usr/local/bin/ladon-ctl", line 103, in <module>
exec("%s(*args,**kwargs)" % cmd.replace('-','_'))
File "<string>", line 1, in <module>
File "/usr/local/bin/ladon-ctl", line 80, in testserve
from ladon.server.wsgi import LadonWSGIApplication
File "/usr/local/lib/python3.4/site-packages/ladon/server/wsgi.py", line 1, in <module>
import ladon.server.wsgi_application as wsgi_application
File "/usr/local/lib/python3.4/site-packages/ladon/server/wsgi_application.py", line 19, in <module>
from docutils.core import publish_parts
File "/usr/local/lib/python3.4/site-packages/docutils/core.py", line 20, in <module>
from docutils import frontend, io, utils, readers, writers
File "/usr/local/lib/python3.4/site-packages/docutils/frontend.py", line 41, in <module>
import docutils.utils
File "/usr/local/lib/python3.4/site-packages/docutils/utils/__init__.py", line 20, in <module>
import docutils.io
File "/usr/local/lib/python3.4/site-packages/docutils/io.py", line 18, in <module>
from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
File "/usr/local/lib/python3.4/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
File "/usr/local/lib/python3.4/locale.py", line 556, in getdefaultlocale
return _parse_localename(localename)
File "/usr/local/lib/python3.4/locale.py", line 484, in _parse_localename
raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8
在terminal中,或者加入bash_profile之后source一下:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
好啦