gpt4 book ai didi

Python-Chess 导入失败

转载 作者:行者123 更新时间:2023-12-01 06:36:28 25 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 16 上安装 python-chess。通过 pip3 安装它,但在导入国际象棋时出现错误。

ujesh@suyodhana:~$ pip3 install python-chess
Collecting python-chess
Using cached https://files.pythonhosted.org/packages/74/f3/b0caa4307443926d9f9ba8752270a8fc159e3ac6c9859c4615244c5ba74c/python_chess-0.30.0-py3-none-any.whl
Installing collected packages: python-chess
Successfully installed python-chess-0.30.0
You are using pip version 8.1.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ujesh@suyodhana:~$ python3
Python 3.5.2 (default, Oct 8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chess
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ujesh/.local/lib/python3.5/site-packages/chess/__init__.py", line 157
BB_ALL = 0xffff_ffff_ffff_ffff
^
SyntaxError: invalid syntax
>>>


任何帮助将非常感激

提前致谢..

最佳答案

这是因为数字文字中的下划线仅在 Python 3.6 中引入(请参阅 PEP515 here )。

要解决这个问题,您需要升级 Python 版本 - 因为 python-chess 0.30.0+ 仅支持 3.6+ - 或将 python-chess 降级到 0.29.0

pip install --force-reinstall python-chess==0.29.0 

关于Python-Chess 导入失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59646376/

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