Flask代码未在Sublime文本2中运行

时间:2014-04-29 10:44:48

标签: python sublimetext2

我已经编写了一个简单的烧瓶应用程序,我尝试通过Sublime文本2运行它,但是这个错误即将到来。现在我已经尝试了默认闲置的代码并且它工作正常。所有系统都正确插入。代码是这样的:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
  return 'Hello World!'

if __name__ == '__main__':
  app.run()

这是错误:

 Traceback (most recent call last):
  File "C:\Users\AKDANI\Downloads\Sublime Text 2.0.2\python_test.py", line 1, in <module>
    from flask import Flask
  File "C:\Python27\lib\site-packages\flask\__init__.py", line 17, in <module>
    from werkzeug.exceptions import abort
  File "C:\Python27\lib\site-packages\werkzeug\__init__.py", line 154, in <module>
    __import__('werkzeug.exceptions')
  File "C:\Python27\lib\site-packages\werkzeug\exceptions.py", line 71, in <module>
    from werkzeug.wrappers import Response
  File "C:\Python27\lib\site-packages\werkzeug\wrappers.py", line 26, in <module>
    from werkzeug.http import HTTP_STATUS_CODES, \
  File "C:\Python27\lib\site-packages\werkzeug\http.py", line 24, in <module>
    from email.Utils import parsedate_tz
  File "C:\Python27\lib\email\__init__.py", line 79, in __getattr__
    __import__(self.__name__)
  File "C:\Python27\lib\email\utils.py", line 28, in <module>
    import socket
  File "C:\Python27\lib\socket.py", line 47, in <module>
    import _socket
ImportError: Module use of python26.dll conflicts with this version of Python.
[Finished in 0.2s with exit code 1]

1 个答案:

答案 0 :(得分:0)

查看Flask support for sublime的此链接可能会对您有所帮助。