报错内容:
Traceback (most recent call last):
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 126, in import_optional_dependency
module = importlib.import_module(name)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "D:\Users\MSI\PycharmProjects\pythonProject\xlrd.py", line 4, in <module>
aaa = pd.read_excel('001.xls',sheet_name='Sheet1')
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 457, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 1363, in __init__
if import_optional_dependency("xlrd", errors="ignore") is None:
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 142, in import_optional_dependency
version = get_version(module_to_get)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 68, in get_version
raise ImportError(f"Can't determine version for {module.__name__}")
ImportError: Can't determine version for xlrd
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Users\MSI\PycharmProjects\pythonProject\xlrd.py", line 4, in <module>
aaa = pd.read_excel('001.xls',sheet_name='Sheet1')
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 457, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 1419, in __init__
self._reader = self._engines[engine](self._io, storage_options=storage_options)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_xlrd.py", line 24, in __init__
import_optional_dependency("xlrd", extra=err_msg)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 129, in import_optional_dependency
raise ImportError(msg)
ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
依旧报错,显示:
Traceback (most recent call last):
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 126, in import_optional_dependency
module = importlib.import_module(name)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "D:\Users\MSI\PycharmProjects\pythonProject\xlrd.py", line 13, in <module>
aaa = pd.read_excel('001.xls',sheet_name='Sheet1')
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 457, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 1363, in __init__
if import_optional_dependency("xlrd", errors="ignore") is None:
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 142, in import_optional_dependency
version = get_version(module_to_get)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 68, in get_version
raise ImportError(f"Can't determine version for {module.__name__}")
ImportError: Can't determine version for xlrd
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Users\MSI\PycharmProjects\pythonProject\xlrd.py", line 13, in <module>
aaa = pd.read_excel('001.xls',sheet_name='Sheet1')
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 457, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 1419, in __init__
self._reader = self._engines[engine](self._io, storage_options=storage_options)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_xlrd.py", line 24, in __init__
import_optional_dependency("xlrd", extra=err_msg)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 129, in import_optional_dependency
raise ImportError(msg)
ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
报错变更了:
Traceback (most recent call last):
File "D:\Users\MSI\PycharmProjects\pythonProject\xlrd.py", line 1, in <module>
import pandas,xlwt,xlrd
File "D:\Users\MSI\PycharmProjects\pythonProject\xlrd.py", line 5, in <module>
aaa = pandas.read_excel('001.xls',sheet_name='Sheet1')
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 457, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py", line 1363, in __init__
if import_optional_dependency("xlrd", errors="ignore") is None:
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 142, in import_optional_dependency
version = get_version(module_to_get)
File "C:\Users\MSI\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\_optional.py", line 68, in get_version
raise ImportError(f"Can't determine version for {module.__name__}")
ImportError: Can't determine version for xlrd