-1
from waitress import serve              # error line 
import app                              # python file where flask code is written
serve(app.app,port=8000,thread=55) 
  1. Python版本:3.7
  2. 女服务员版本:尝试使用 1.4.1 和 1.3.0*

堆栈跟踪

C:\Users\ashish.kamble\ModelDeployment\Scripts\python.exe C:/Users/ashish.kamble/PycharmProjects/ModelDeployment/waitress.py
Traceback (most recent call last):
  File "C:/Users/ashish.kamble/PycharmProjects/ModelDeployment/waitress.py", line 1, in <module>
    from waitress import serve
  File "C:\Users\ashish.kamble\PycharmProjects\ModelDeployment\waitress.py", line 1, in <module>
    from waitress import serve
ImportError: cannot import name 'serve' from 'waitress' (C:\Users\ashish.kamble\PycharmProjects\ModelDeployment\waitress.py)

Process finished with exit code 1
4

1 回答 1

1

由于您的文件名为waitress.py.

当您运行代码时,您的waitress关键字将作为文件的对象。如果您想摆脱该错误,请将您的 python 文件重命名为不代表您的库的文件。

加法- :最好使用 Pycharm 项目解释器安装库。按照以下步骤使用解释器安装库。

于 2020-05-07T12:19:31.050 回答