当前位置: 代码迷 >> python >> 导入 Pylot 会导致 flask.py 中出现“无效语法”错误
  详细解决方案

导入 Pylot 会导致 flask.py 中出现“无效语法”错误

热度:124   发布时间:2023-06-19 09:14:07.0

我是 Python 新手,我想复制本教程: : wQ8BIBpya2k 但是当我尝试导入 Matpotlib.pylot 时出现此错误:“ModuleNotFoundError: No module named 'matplotlib .pylot'" 所以现在我尝试手动安装 Pylot 但它给我一个语法错误:

D:\Python>pip3 install --upgrade --no-cache-dir pylot
Collecting pylot
  Downloading https://files.pythonhosted.org/packages/6f/18/1d14c2f30b46c92c01ec3aa8499553e73e1f3258188a9abecefb784fb7a5/Pylot-0.0.4.tar.gz (2.8MB)
    100% |████████████████████████████████| 2.8MB 5.1MB/s
Collecting Flask==0.10.1 (from pylot)
  Downloading https://files.pythonhosted.org/packages/db/9c/149ba60c47d107f85fe52564133348458f093dd5e6b57a5b60ab9ac517bb/Flask-0.10.1.tar.gz (544kB)
    100% |████████████████████████████████| 552kB 4.1MB/s
Collecting Flask-Classy==0.6.10 (from pylot)
  Downloading https://files.pythonhosted.org/packages/92/07/bbe7a8aefd8799fc456f711b86952457b3e63c8aec9dfd4c911c55df9ea7/Flask-Classy-0.6.10.tar.gz
Collecting Flask-Assets==0.10 (from pylot)
  Downloading https://files.pythonhosted.org/packages/95/de/88eb544c93313031e7b85758a1443730b92e7b1d01ec7222ddfea5f382e7/Flask-Assets-0.10.tar.gz
Collecting flask-recaptcha==0.3 (from pylot)
  Downloading https://files.pythonhosted.org/packages/2a/fb/866560e195c499c9e6aed83f577f311cdbeeaab7d8fe0fca71d27f4ae3cb/Flask-ReCaptcha-0.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\fried\AppData\Local\Temp\pip-install-z6djdn7w\flask-recaptcha\setup.py", line 3, in <module>
        import flask_recaptcha
      File "C:\Users\fried\AppData\Local\Temp\pip-install-z6djdn7w\flask-recaptcha\flask_recaptcha.py", line 12, in <module>
        from flask import request
      File "c:\users\fried\appdata\local\programs\python\python36\lib\site-packages\flask.py", line 148
        except HTTPException, e:
                            ^
    SyntaxError: invalid syntax

Command "python setup.py egg_info" failed with error code 1 in C:\Users\fried\AppData\Local\Temp\pip-install-z6djdn7w\flask-recaptcha\

matplotlib 中的模块称为pyplot ,而不是pylot PyPI 上的pylot与 matplotlib 完全无关。