简体   繁体   中英

No module named 'odf' due to wrong Python version

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?

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.

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.

In my case i was getting same error while using import-export django module. Installing odf library didn't worked got same error. I resolve this issue by simply pip install tablib==0.14.0 .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM