Home > Software engineering >  No module named 'odf' due to wrong Python version
No module named 'odf' due to wrong Python version

Time:12-13

I have many different versions of Python, but a version that I use and that terminal show me if use command Python – version is 3.10.0.

When I use command pip list I got a big list of library, including the one I recently installed odfpy.

I open VsCode, choose Python version 3.10.0 and try to import odf but... ModuleNotFoundError: No module named 'odf'

For sure I need to set something on VsCode or change some configuration in Linux but I cannot find a normal explanation of how to solve this issue.

If I change the Python version in VsCode with 3.8.10, odfpy (and also Django just installed) is recognized. So I suppose that, even if the Python version selected on the terminal is 3.10.0, when I pip install something, is installed on version 3.8.10. How do you manage this?

CodePudding user response:

Please check which pip you are using through the command of pip --version.

After you switch the python interpreter in the VSCode, please create a new terminal, and make sure it has activated the environment you have selected.

CodePudding user response:

I also use VS code and use Python 3.10 and i had try to download the odfpy which has gone alright, i use the command python -m pip install odfpy

try and see if it work for you though.

If it does not work, maybe try and create a virtual environment if you haven't created it yet.

  • Related