尝试导入已安装的Python模块收到错误

时间:2020-09-21 16:34:15

标签: python python-import importerror pythonpath

我是python的新手,所以这可能是一个简单的修复程序,但是我无法通过谷歌搜索找到解决方案。尝试在模块上运行导入时出现此错误。

Traceback (most recent call last):
  File "c:/Users/joeshmo/OneDrive - company Industries/Documents/Python/Excel Join/join.py", line 1, in <module>
    from openpyxl import load_workbook
ModuleNotFoundError: No module named 'openpyxl'

Openpyxl已经安装,因为pip给了我这个...

pip install openpyxl    
Requirement already satisfied: openpyxl in c:\users\joeshmo\appdata\local\programs\python\python38-32\lib\site-packages (3.0.5)
Requirement already satisfied: jdcal in c:\users\joeshmo\appdata\local\programs\python\python38-32\lib\site-packages (from openpyxl) (1.4.1)
Requirement already satisfied: et-xmlfile in c:\users\joeshmo\appdata\local\programs\python\python38-32\lib\site-packages (from openpyxl) (1.0.1)

Python安装在这里...

C:\Users\joeshmo\AppData\Local\Programs\Python\Python38-32

此处的PythonPath ...

C:\Users\joeshmo\AppData\Local\Programs\Python\Python38-32\python38.zip
C:\Users\joeshmo\AppData\Local\Programs\Python\Python38-32\DLLs
C:\Users\joeshmo\AppData\Local\Programs\Python\Python38-32\lib
C:\Users\joeshmo\AppData\Local\Programs\Python\Python38-32
C:\Users\joeshmo\AppData\Roaming\Python\Python38\site-packages
C:\Users\joeshmo\AppData\Local\Programs\Python\Python38-32\lib\site-packages

在Windows 10上。

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

与一位同事进行故障排除后,我们发现我运行了2个版本的python。我可以运行“ py”(3.8.0)或“ python”(3.8.5)。卸载旧版本后。这不再是问题。