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?
python3.9 -m pip install pandas
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 link pip3
from your python 3.9 version to the pip
command.
Now you can do pip install pandas
to install the pandas dependency into the venv.
Another solution would be to use Anaconda or Miniconda
https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html
conda create -n name_of_my_env python
This will create a minimal environment with only Python installed in it.
To put your self inside this environment run:
source activate name_of_my_env
On Windows the command is:
activate name_of_my_env
The final step required is to install pandas. This can be done with the following command:
conda install pandas
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.