打印“EXTERNSHEET(b7-):”熊猫

cod*_*ing 4 python xlrd pandas

我试图像往常一样运行我的图书馆“熊猫”,但后来我遇到了一个错误

import pandas as pd

DF_temp = pd.read_excel("example.xlsx")

Run Code Online (Sandbox Code Playgroud)

输出

  File "/opt/anaconda3/lib/python3.7/site-packages/xlrd/__init__.py", line 1187
    print "EXTERNSHEET(b7-):"
                            ^
SyntaxError: invalid syntax

Run Code Online (Sandbox Code Playgroud)

我正在使用 python 3.7

我再次安装了 xlrd,但出现了同样的问题。我该如何解决这个问题?谢谢

小智 6

有同样的问题并使用了建议的修复 python3 -m pip install --upgrade xlrd 即使我收到了一些警告,它也为我工作。

Defaulting to user installation because normal site-packages is not writeable
Collecting xlrd
  Downloading xlrd-1.2.0-py2.py3-none-any.whl (103 kB)
     |????????????????????????????????| 103 kB 6.0 MB/s eta 0:00:01
Installing collected packages: xlrd
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

camelot 12.6.29 requires SQLAlchemy<0.8.0,>=0.7.7, but you'll have sqlalchemy 1.3.14 which is incompatible.
camelot 12.6.29 requires xlrd==0.7.1, but you'll have xlrd 1.2.0 which is incompatible.
Successfully installed xlrd-1.2.0
Note: you may need to restart the kernel to use updated packages.
Run Code Online (Sandbox Code Playgroud)


小智 6

该问题的解决方案是更新 xlrd 库。只需运行此命令即可解决问题:

!pip install --upgrade xlrd
Run Code Online (Sandbox Code Playgroud)