Pandas已安装,但在Mac上的IDLE中未被识别。

huangapple go评论78阅读模式
英文:

Pandas installed but not recognised by IDLE on Mac

问题

I am relatively new to Python.

我对Python相对较新。

I had installed Anaconda when I was practicing Python. Jupyter Notebooks was causing issues so I installed IDLE.

在练习Python时,我安装了Anaconda。Jupyter Notebooks引发了问题,所以我安装了IDLE。

The installation of Python and Idle3 is in the same location.

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 is also installed in the same user.

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)

In IDLE Shell 3.11.3

在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'

Additional Data that could help

附加数据可能有助于解决问题

(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 is working fine on Jupyter Notebook. Suggestions would be helpful.

在Jupyter Notebook上,Pandas正常工作。建议可能会有所帮助。

I wanted to access the pandas module in python. I have checked other answers but none have been directing to this issue. If the installation is correct, pandas should be running fine.

我想在Python中访问pandas模块。我已经检查了其他答案,但没有一个指向这个问题。如果安装正确,pandas应该正常运行。

英文:

I am relatively new to Python.

I had installed Anaconda when I was practicing Python. Jupyter Notebooks was causing issues so I installed IDLE.

The installation of Python and Idle3 is in the same location.

(base) myname@myMac ~ % which python
/Users/myname/opt/anaconda3/bin/python
(base) myname@myMac ~ % which idle3
/Users/myname/opt/anaconda3/bin/idle3

Pandas is also installed in the same user

(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)

In 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'

Additional Data that could help

(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 is working fine on Jupyter Notebook. Suggestions would be helpful.

I wanted to access the pandas module in python. I have checked other answers but none have been directing to this issue. If the installation is correct, pandas should be running fine.

答案1

得分: 0

你的默认Python版本是3.9。因此,当你使用pip安装任何库时,它使用的是Python 3.9的pip。如果你有3.9版本的Shell,那么在IDLE Shell 3.9.*中导入pandas不会出现问题。

要使用Python 3.11的pip,请使用以下命令:

python3.11 -m pip install pandas

英文:

your default Python version is 3.9. So when you use pip to install any library it uses the pip of python3.9. So you will have no problem importing pandas in IDLE Shell 3.9.* if you have 3.9 shell.

So to use the pip of python3.11 use ->

python3.11 -m pip install pandas

huangapple
  • 本文由 发表于 2023年4月13日 17:19:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76003770.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定