I have installed pandas in my venv. The import statement from pandas import DataFrame
is not recognized in Pycharm. DataFrame is underlined with red line. When I run the code, it works fine. Why DataFrame is not recognized.
Also suddenly, relative paths of local packages stopped working in PyCharm but code runs fine though. Absolute path also works fine.
I have tried setting project as "source code" in settings but does not solve the problem.
You might install the DataFrame on your default python environment.
To make sure you have installed on venv
environment.
1- Activate your venv
either form terminal or command-prompt by execuitng: source ~/envs/venv/bin/activate
2- Install pandas: pip install pandas
Now If you have installed correctly you will have a warning. Otherwise the package will be installed on your venv
environment.
Finally, uninstalled PyCharm and installed again. It solved my problem.
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.