import pandas显示无此模块_ImportError:没有名为pandas的模块。熊猫装点

在Mac上遇到Python导入pandas时出现ModuleNotFoundError。解决方案是:首先,在项目文件夹内安装virtualenv以隔离环境;然后,在项目根目录下激活虚拟环境;最后,在虚拟环境中使用pip安装pandas和其他所需包,避免与其他外部包冲突。
摘要由CSDN通过智能技术生成

i use mac terminal to check my package:

pip list

i can find all packages include pandas

but when i

import pandas

it told me:

ModuleNotFoundError: No module named 'pandas'

by the way, i have python2 and python3 in my mac, they are not the same directory,i suspect python didn't find the path of pandas

解决方案

First of all, install virtualenv inside your project folder to secure your project directory to avoid conflict with your other packages.

pip install virtualenv

After installing this run this command one by one inside your root project directory:

virtualenv venv

source venv/bin/activate

Now Your directory is secure and you can install your required packages inside.

pip install pandas

and others as you required.

Because you have installed virtualenv and running as secure it will not conflict with other outside packages.

Use this all steps one by one. I hope it will work for you to avoid such error.

Thanks.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值