问题描述
我使用mac终端检查我的包裹:
i use mac terminal to check my package:
pip list
我可以找到所有包含熊猫的包裹
i can find all packages include pandas
但是当我
import pandas
它告诉我:
顺便说一句,我在我的mac电脑中有python2和python3,它们不是同一目录,我怀疑python没有找到熊猫的路径
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
推荐答案
首先,在项目文件夹中安装virtualenv
以保护项目目录,以避免与其他软件包冲突.
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
和其他您需要的内容.
由于已安装virtualenv
并以安全方式运行,因此不会与其他外部软件包冲突.
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.
谢谢.
这篇关于ImportError:没有名为pandas的模块. pandas 装点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!