[Python] Python cannot import serial [duplicate]

Discussão em 'Python' iniciado por Stack, Março 21, 2025.

  1. Stack

    Stack Membro Participativo

    Having Python 3.7.6 and having already installed pyserial,

    pip install pyserial --user
    Requirement already satisfied: pyserial in c:\users\myusername\appdata\local\programs\python\python37\lib\site-packages (3.4)

    pip install pyserial
    Requirement already satisfied: pyserial in c:\users\myusername\appdata\local\programs\python\python37\lib\site-packages (3.4)


    I expect that I can import serial via import serial which fails.


    No module named 'serial'
    ​

    This is as follows

    python3
    Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 01:54:44) [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import serial
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'serial'


    Am I doing any mistake?


    PS. The result of import sys; print(sys.path) is

    [
    '',
    'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\\python37.zip',
    'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\\DLLs',
    'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\\lib',
    'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0',
    'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\\lib\\site-packages'
    ]


    PS. The result of where pip is

    C:\Users\myusername\AppData\Local\Programs\Python\Python37\Scripts\pip.exe
    C:\Users\myusername\AppData\Local\Microsoft\WindowsApps\pip.exe

    Continue reading...

Compartilhe esta Página