我可以在Xcode上运行Python代码,并且我设法使用pip安装了pandas模块,但如果我尝试导入它,我会出现以下错误:ModuleNotFoundError:没有名为"pandas"的模块
确保您拥有最新版本的xcode。从Macports为您的MacOS版本安装Macports。安装pkg后,请更新macports并确认系统是否按预期工作。打开一个终端窗口并键入sudo port selfupdate
,它应该返回MacPorts base is already the latest version
。假设您有python 3.7,请键入sudo port install py37-pip
来安装pip。要确保系统默认使用pipforPython3,请键入:sudo port select --set pip pip37
。然后安装熊猫sudo pip install -U scikit-learn
。