I have tried answers posted here
But I still can't fix the same issue. Here is my python code:
import xlrd
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile
df = pd.read_excel('airquality.xlsx')
print("Column headings:")
print(df.columns)
:!python 'readexcel.py'
Traceback (most recent call last):
File "readexcel.py", line 1, in <module>
import xlrd
ImportError: No module named xlrd
shell returned 1
While I check the xlrd it shows it has been satisfied:
$python --version
Python 3.6.9
$ pip3 install xlrd
Requirement already satisfied: xlrd in /usr/local/lib/python3.6/dist-packages (1.2.0)
while in terminal, it seems no issue:
python
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlrd
>>>
Try:
pip3 install --upgrade xlrd
python3 readexcel.py
在 .vimrc 中解决(使用 !python3 而不是 !python):
nnoremap <buffer> <F9> :exec '!python3' shellescape(@%, 1)<cr>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.