gpt4 book ai didi

python - Webapp2导入错误: cannot import name _thread

转载 作者:太空宇宙 更新时间:2023-11-03 16:12:21 24 4
gpt4 key购买 nike

我尝试从终端启动 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 6

关于python - Webapp2导入错误: cannot import name _thread,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39162746/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com