Webapp2 ImportError: cannot import name _thread
Webapp2 ImportError: cannot import name _thread
我正在尝试从终端启动 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()
在 Mac OS 系统上似乎存在 运行 这个问题。见
https://github.com/pypa/pip/issues/3165
要修复,我必须卸载粘贴,即 sudo pip uninstall paste 然后 运行,
sudo pip install paste --ignore-installed 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()
在 Mac OS 系统上似乎存在 运行 这个问题。见
https://github.com/pypa/pip/issues/3165
要修复,我必须卸载粘贴,即 sudo pip uninstall paste 然后 运行, sudo pip install paste --ignore-installed six