Reputation: 155
If I do something like "import selenium" (or any other kind of third party library) in a .py file and then run it from the terminal, it works just fine. But if I make a new file in PyCharm CE and do the same thing, it can't find the library / module.
How can I fix this or get it to point in the right location? I use a Macbook Pro.
Upvotes: 2
Views: 4641
Reputation: 3139
I've faced a similar issue on Pop!_OS after installing PyCharm via Flatpak. I think the installation is somehow incomplete, as I've had these issues (among others):
sh
. Even after changing to bash
, it would not read my .bashrc
and many commands were missing.virtualenv
, it would just default to Python 3.7 (even though the version was actually 3.8) and it didn't see any of my installed libraries.I've eventually uninstalled PyCharm and downloaded it directly from Jetbrains website to make it work correctly.
Upvotes: 2
Reputation: 78536
You need to setup your project in PyCharm to use the Python interpreter that has your libraries:
Go to: file->settings->project->project interpreter
And select the appropriate interpreter from the dropdown. After selecting an interpreter, the window displays a list of libraries installed on that interpreter; this should further help you make the right selection.
Upvotes: 5