Reputation: 65
I am trying to use the pyserial
module in my python project, so i installed it with pip install pyserial
. After doing that, I did import pyserial
in my python interpreter and it gave me this error:
Pyserial appears in my pip list
list, and when i do pip show pyserial
it gives this result:
Upvotes: 2
Views: 4396
Reputation: 2455
I think you're using a wrong import statement, import pyserial
will give you and should give you the above error .
The correct import statement is import serial
, so try this instead.
Always it's a good thing to read the documentation, you can read more about pyserial on the docs here
Upvotes: 3
Reputation: 1925
Pycharm has a different way to install packages. You shouldn't install them via pip
. I'm not sure why pip
doesn't always install packages properly is though.
Instead, you can install it by opening the tool page in the main menu. This is available for PyCharm 2021.1 and later.
View -> Tool Windows -> Python Packages -> Search
You can also open the project interpreter to install packages.
Settings (CTRL+ALT+S) -> Project_Name -> Python Interpreter -> + (symbol at bottom) -> Search
See this article for a more complete tutorial.
Upvotes: 2
Reputation: 65
I fixed this problem in PyCharm by typing import serial
and it gave me an option to auto-install it. I took that option, and it worked.
Upvotes: 1