python - import pandas returning 'no module named pandas'
问题描述
I cannot use pandas in my script. It's my first time using a package, and it doesn't work. When I use pip install pandas the cmd prompt returns:
PS C:\Users\young> pip install pandas
3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.3.1)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\young\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2017.3 in c:\users\young\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pandas) (2021.1)
Requirement already satisfied: numpy>=1.17.3 in c:\users\young\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pandas) (1.21.1)
Requirement already satisfied: six>=1.5 in c:\users\young\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from python-dateutil>=2.7.3->pandas) (1.1PS C:\Users\young> pip3.9 install wheel
Requirement already satisfied: wheel in c:\users\young\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (0.36.2)
解决方案
这是多安装 python 的典型问题。请检查您是否安装了多个 Python。如果是的话,那么......
您可以使用以下命令检查应保存已安装软件包的位置
导入 os os.path 然后使用以下终端指令安装
pip3 install pandas -t /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6
推荐阅读
- julia - julia 在 python 中是否具有与 hstack 等效的功能?
- r - 使用 R 导入文件数据
- python - 导入 numpy - ImportError:导入 mtrand 时 DLL 加载失败
- mysql - 为什么我需要在 My SQL Create Table 子句中指定“Engine=Innodb”?
- javafx - 如何对齐 JFoenix 快餐栏?
- python - 您如何向其所在的服务器发送邀请。(discord.py)
- python - 过滤今天日期的所有条目(熊猫)
- reactjs - 你如何处理 POST 形式的外键?
- sql - SQL case 语句采用别名值
- java - Error with private field using @Autowired