[Python] pipx installed xlwings module not found

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

  1. Stack

    Stack Membro Participativo

    I have an Excel workbook that uses an xlwings RunPythonScript() call to an external python script. As I want to run this python script outside of my vdev I've installed pipx and through pipx installed xlwings. The pipx path (~.local/bin) is included in the Sub RunPythonScript() below.

    Sub RunPythonScript()
    'RunPython "import sys; sys.path.append(r'/Users/xxxx/Sync/Python-dev/scripts'); import SOP_callPython; SOP_callPython.my_function()"
    RunPython "import sys; sys.path.extend([r'/Users/xxxx/Sync/Python-prod/scripts', r'/Users/xxxx/.local/bin']); import SOP_callPython; SOP_callPython.my_function()"
    Call InsertTimestamp
    End Sub


    When I run this vba Sub within the workbook the python script runs but displays ModuleNotFoundError: No module named 'xlwings' when trying to import xlwings. All these same scripts work fine in my vdev so why isn't it 'finding' the pipx install of xlwings?

    Continue reading...

Compartilhe esta Página