Python Flask中的FileNotFoundError

Python Flask中的FileNotFoundError,flask,python-3.6,Flask,Python 3.6,我正在尝试运行我的烧瓶应用程序 我没有直接打开任何文件。Python 3.6。PyCharm IDE 2019.1.2 application = Flask(__name__, template_folder='template', static_url_path='/static') Talisman(application, content_security_policy=csp) if __name__ == "__main__": application.run(debug=T

我正在尝试运行我的烧瓶应用程序

我没有直接打开任何文件。Python 3.6。PyCharm IDE 2019.1.2

application = Flask(__name__, template_folder='template', static_url_path='/static')
Talisman(application, content_security_policy=csp)
if __name__ == "__main__":
    application.run(debug=True, ssl_context='adhoc')
这也不起作用:

if __name__ == "__main__":
    application.debug = True
    application.run()
当我运行它时,我收到以下错误:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python/bin/python3.6': '/usr/local/opt/python/bin/python3.6'

我重复-我没有直接打开任何文件。尝试运行应用程序时会引发此错误。

我发布此问题有两个原因:

  • 回答它,因为我相信我发现了这个错误的一个边缘案例
  • 在Flask抛出此错误时启动一个线程
我的解决方案:

我连接到了公共/一个不同于正常连接的WiFi


一旦我连接到我的个人WiFi,程序就会正常运行,并且不会抛出此错误。

这可能发生的另一个原因:

我重置了计算机上的一些设置,使Python 2成为Python的默认版本

使用python application.py运行Flask应用程序导致抛出此错误

使用python3application.py运行Flask解决了这个问题