I am trying to install pandas on mac. I use this command in terminal:
pip install pandas
. I get Requirement already satisfied
. But in pycharm I can not import pandas.
My python version in terminal is 3.9.13
and pycharm python version is 3.10
.
If the problem is because of different python versions, how can I fix it? Thanks
CodePudding user response:
You can solve this by using VENV. Go to the project dir and type in the below commands:
python3.10 -m venv venv
. ./venv/bin/activate
pip install pandas
Now go to pycharm settings and make it use the python sdk from the venv dir. That should solve the issue.
Or you can open the terminal inside pycharm and then do a pip install pandas
over there. That should solve the issue as well.
CodePudding user response:
You should check what python interpeter your python project is using. Pycharm, generally, sets up a virtual env (isolated python environment) in project directory. You can see Python version in right bottom corner in PyCharm. If you click it a dropdown will show up, with choice of interpreters. If you then go to "Interpreter Settings" you will see some more information.
As for installing packages, you can try go to your project directory and enter pycharm's virtual env (if it exists):
source venv/bin/activate
Then try
pip install pandas
As for bash shell, you can check which executable you are using with use of 'which' command.
which pip
If it displays something like that:
> /home/user/myproject/venv/bin/pip
it uses virtualenv pip.