Webapp2 ImportError:无法导入名称_thread

时间:2016-08-26 09:18:49

标签: python webapp2 httpserver six

我正在尝试从终端启动webapp2开发服务器,但是我收到此错误

> File "/Users/mertbarutcuoglu/Desktop/hellowebapp2/main.py", line 12,
> in main
>     from paste import httpserver   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/paste/httpserver.py",
> line 29, in <module>
>     from six.moves import _thread ImportError: cannot import name _thread

这是python脚本:

import webapp2

class HelloWebapp2(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello, webapp2!')

app = webapp2.WSGIApplication([
    ('/', HelloWebapp2),
], debug=True)

def main():
    from paste import httpserver
    httpserver.serve(app, host='127.0.0.1', port='8080')

if __name__ == '__main__':
    main() 

1 个答案:

答案 0 :(得分:1)

在Mac OS系统上运行此问题似乎存在问题。参见

https://github.com/pypa/pip/issues/3165

修复,我不得不卸载粘贴,即sudo pip卸载粘贴然后运行, sudo pip install paste --ignore-installed six