首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python-Chess导入失败

Python-Chess导入失败
EN

Stack Overflow用户
提问于 2020-01-08 20:56:32
回答 1查看 421关注 0票数 1

我正在尝试在Ubuntu16上安装python-chess。我通过pip3安装了它,但在导入国际象棋时遇到错误。

代码语言:javascript
复制
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
>>>

任何帮助都是非常感谢的。

提前谢谢..

EN

回答 1

Stack Overflow用户

发布于 2020-01-08 21:03:21

这是因为数字文字中的下划线只在Python3.6中引入(参见PEP515 here)。

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

代码语言:javascript
复制
pip install --force-reinstall python-chess==0.29.0 
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59646376

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档