-2

Running MacOS. I was running python 3.9, and upgraded to the latest Python distro (3.12.3).

When I went to install the spellchecker package, pip installed it in /Applications/anaconda3/lib/python3.9/site-packages.

But when I try to import the package, I get ModuleNotFound. When I check sys.path, I get

[
'', 
'/Library/Frameworks/Python.framework/Versions/3.12/lib/python312.zip', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages'
].

How can I get pip to install packages in the right directory?

1 Answer 1

0

I originally installed Python 3.9 when I installed anaconda.

My mistake was directly upgrading to Python 3.12.3. Once I did that, imports stopped working (due to module "masking" in conflicting "site-packages" directories -- Python is just totally broken in how they do this).

I won't make that mistake again.

For anyone reading this, it's better to just uninstall everything and reinstall a whole new Python ecosystem via anaconda.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .