ImportError: No module named 'xlrd'

后端 未结 12 709
孤城傲影
孤城傲影 2020-12-16 09:29

I am currently using PyCharm with Python version 3.4.3 for this particular project.

This PyCharm previously had Python2.7, and I upgraded to 3.4.3.

I am tryi

相关标签:
12条回答
  • 2020-12-16 09:52

    If you are in a terminal under Bash or any other semi-advanced shell with tab-completion, try to write pip followed by <tab>. If I do it, I see written:

    none@vacuum:~$ pip  
    pip     pip3    pip3.5  pip3.6
    

    As you can see, I can choose to run pip commands under pip only, but I can choose even newer versions of pip. To know what version is associated to the pip command (with nothing else) run as usual pip with the --version or -V flag. In my case, pip -V yields:

    none@vacuum:~$ pip -V  
    pip 9.0.1 from /usr/local/lib/python3.6/dist-packages (python 3.6)
    

    Besides this, if you are developing under PyCharm, you may press Alt+Enter when the cursor is under the module name which cannot be imported to open a context-sensitive floating menu that will allow you to install the module. (You can also manage the list of installed modules for a specific Python version in the settings menu of PyCharm, under the Project Interpreter sub-menu.)

    0 讨论(0)
  • 2020-12-16 09:54

    Click on the Bulb icon right next to the "import xlrd" & click on install package clrd , it will automatically install the package

    0 讨论(0)
  • 2020-12-16 09:54

    If you are using a virtual environment use "pipenv install xlrd" instead of "pip install xlrd". That should work.

    0 讨论(0)
  • 2020-12-16 09:57

    If you are facing issues in Windows then try the steps below which works for me:

    1. go to the location %localappdata%
      • C:\Users\<YourSystem>\AppData\Local\Programs\Python\Python38-32\Scripts
    2. Open cmd ternimal at this location
    3. run pip install xlrd
    0 讨论(0)
  • 2020-12-16 10:02

    For me the solution was uninstalling xlrd using pip uninstall xlrd, and then installing it again using pip install xlrd.

    0 讨论(0)
  • 2020-12-16 10:03

    I had the same problem. I went to the terminal (Using Linux), and typed

    sudo pip3 install xlrd
    

    Then I imported xlrd in python and used the same code:

    df = pd.read_excel("File.xlsx", "Sheet1")
    print (df)
    

    It worked for me!!

    0 讨论(0)
提交回复
热议问题