ModuleNotFoundError: No module named 'pandas' in Qt Creator

ModuleNotFoundError: No module named 'pandas' in Qt Creator

我最近创建了我的第一个 qt quick2 pyside 应用程序,我有一个名为 TestClass 的 python class,我之前在 visual studio 中使用过,没有错误,我决定在 qt quick pyside 应用程序中使用这个 class 但它有以下错误:

我已经安装了pyside6,我的python版本是39.2,qt版本是5.15.2

Traceback (most recent call last):
  File "D:\QtProjects\qtforpythonprojects\FirstApplication\main.py", line 4, in <module>
    from TestClass import TestClass
  File "D:\QtProjects\qtforpythonprojects\FirstApplication\TestClass.py", line 2, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

当我在 cmd 中插入以下命令时:

>pip3 install pandas
Requirement already satisfied: pandas in c:\users\jooya\anaconda3\lib\site-packages (1.1.3)
Requirement already satisfied: numpy>=1.15.4 in c:\users\jooya\anaconda3\lib\site-packages (from pandas) (1.19.2)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\jooya\anaconda3\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\jooya\anaconda3\lib\site-packages (from pandas) (2020.1)
Requirement already satisfied: six>=1.5 in c:\users\jooya\anaconda3\lib\site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)

QtCreator 使用的 python 可能与您安装的 pandas 不同。解决方案是为此使用正确的 python 转到工具-> 选项-> Python 和 select 正确的路径。