image
LP小透明

当你感到无聊的时候,就去学习,因为一旦你开始认真学习,就会立刻发现比学习有趣的事来打断你的学习

python 升级导致 反引号 错误 SyntaxError: invalid syntax

LP小透明    2020-05-15 16:25

最近,升级Python部分库版本后启动flask出现 如下错误很是诡异:
$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 15, in <module>
  File "\Python\lib\site-packages\flask_migrate\__init__.py", line 12, in <module>
    from alembic.config import Config as AlembicConfig
  File "\Python\lib\site-packages\alembic\config.py", line 7, in <module>
    from . import command
  File "\Python\lib\site-packages\alembic\command.py", line 3, in <module>
    from .script import ScriptDirectory
  File "\Python\lib\site-packages\alembic\script\__init__.py", line 1, in <module>
    from .base import ScriptDirectory, Script  # noqa
  File "\Python\lib\site-packages\alembic\script\base.py", line 2, in <module>
    from dateutil import tz
  File "\Python\lib\site-packages\dateutil\tz.py", line 78
    `self._name`,
    ^
SyntaxError: invalid syntax
应该是dateutil 库文件版本不支持所致,解决办法:
​​​​​​​pip install -U python-dateutil
Collecting python-dateutil
  Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
     |████████████████████████████████| 235kB 6.9kB/s
Installing collected packages: python-dateutil
  Found existing installation: python-dateutil 1.5
    Uninstalling python-dateutil-1.5:
      Successfully uninstalled python-dateutil-1.5
Successfully installed python-dateutil-2.8.1
再次启动,问题解决。
Last Modified: 2020-05-15 16:28
Views: 2.9K

[[total]] comments

Post your comment
  1. [[item.time]]
    [[item.user.username]] [[item.floor]]Floor
  2. Click to load more...
  3. Post your comment