我对Python还是比较陌生的。
我在练习Python的时候安装了Anaconda。Jupyter Notebooks导致了问题,所以我安装了IDLE。
Python和Idle3的安装位置相同。
(base) myname@myMac ~ % which python
/Users/myname/opt/anaconda3/bin/python
(base) myname@myMac ~ % which idle3
/Users/myname/opt/anaconda3/bin/idle3
Pandas也安装在同一用户
(base) myname@myMac~ % pip install pandas
Requirement already satisfied: pandas in ./opt/anaconda3/lib/python3.9/site-packages (2.0.0)
Requirement already satisfied: tzdata>=2022.1 in ./opt/anaconda3/lib/python3.9/site-packages (from pandas) (2023.3)
Requirement already satisfied: python-dateutil>=2.8.2 in ./opt/anaconda3/lib/python3.9/site-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in ./opt/anaconda3/lib/python3.9/site-packages (from pandas) (2022.1)
Requirement already satisfied: numpy>=1.20.3 in ./opt/anaconda3/lib/python3.9/site-packages (from pandas) (1.21.5)
Requirement already satisfied: six>=1.5 in ./opt/anaconda3/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)
在IDLE Shell 3.11.3中
import pandas
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
可能有帮助的其他数据
(base) myname@myMac 3.11 % which -a python python2 python2.7 python3 python3.6 python3.11
/Users/myname/opt/anaconda3/bin/python
/Users/myname/opt/anaconda3/bin/python3
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
/usr/local/bin/python3
/usr/bin/python3
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11
/usr/local/bin/python3.11
Pandas在Jupyter Notebook上运行良好。建议会很有帮助。
我想在python中访问pandas模块。我已经检查了其他答案,但没有人针对这个问题。如果安装正确,pandas应该运行正常。
1条答案
按热度按时间6ie5vjzr1#
你的默认Python版本是3.9。所以当你使用pip来安装任何库时,它使用python3.9的pip。所以如果你有3.9 shell,你在IDLE Shell 3.9.* 中导入pandas不会有问题。
所以要使用python3.11的pip,请使用-〉
python3.11 -m pip install pandas