I have a device with python3.7 preinstalled, in which i have installed also python3.9. I managed to change the version I am using of python3 and now the command "python3" followed by the .py file runs with python3.9.
The problem is I tried installing pandas with pip3 but it does not work (it didn’t work even in the preinstalled python3.7), so I found that in debian you can install package, for example in this case pandas, using "sudo apt-get install python3-pandas" but this command keeps installing pandas in python3.7 and not in python3.9 even if now "python3" refers to python3.9.
Has anyone ever encountered this problem and has a solution?
2
Answers
python3.9 -m pip install pandas
Venv
You could use a virtual environment (venv) for installing dependencies.
This venv could be project specific or global.
Run
python3 -m venv .venv
in your project folder to create a.venv
folder, which holds the venv configuration.Run
source .venv/bin/activate
to activate the venv. This will linkpip3
from your python 3.9 version to thepip
command.Now you can do
pip install pandas
to install the pandas dependency into the venv.Conda
Another solution would be to use Anaconda or Miniconda
https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html