ImportError: No module named 'xlrd'

后端 未结 12 708
孤城傲影
孤城傲影 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:39

    I have python 2.7, 3.5 and 3.6 in my linux Mint machine for some reasons.

    My spyder uses python 3.5 and I had the same issue. What I have done is

    • go to the folder /usr/local/lib/python2.7/dist-packages
    • Copy the folder xlrd (Note that to do this action you have right click and open as root)
    • Now go to the /usr/local/lib/python3.5/dist-packages or /usr/local/lib/python3.6/dist-packages and paste the folder xlrd over there.

    It worked for me!!!

    This method does not change the default path so that, I can still continue with python 2.7 without any harm(something like SageMath which I use extensively)

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

    You have to download xlrd library because pandas require it.

    In Pycharm I downloaded it in File -> Settings -> Project: [PROJECT NAME] -> Project Interpreter enter image description here

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

    The problem seems to be because of multiple python versions in the system, where requirement might be satisfied for one and not for the other.

    In this case the requirement is satisfied for python2 but not for python3, you need to specify that the download needs to be for python3.

    In reference to the answers mentioned above, what worked for me is

    python3 -m pip install xlrd
    

    specifying python3 rather than pip3 worked for me.

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

    I copy the modules xlrd and xlrd-1.2.0.dist-info to the project file after pip/conda install xlrd , and it worked.

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

    Running the pip install xlrd completed the installation, but that did not resolve the "no named module named xlrd" error.

    Copying the xlrd folder to the same folder where the .py programs are stored, resolved this issue.

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

    The same happened to me using pycharm, I had installed it with pip, pip3 and anaconda and it still didn't work. I manually installed the package from pycharm-> preferences -> project -> project interpreter -> + and it worked.

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