[Python] ModuleNotFoundError: No module named 'distutils' in Python 3.12.1 when installing...

Discussão em 'Python' iniciado por Stack, Fevereiro 23, 2025.

  1. Stack

    Stack Membro Participativo

    I try to install oci-cli using this reference https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm#InstallingCLI__windows in Python 3.12.1, I get this error

    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'distutils'
    Traceback (most recent call last):
    File "C:\Users\badia\AppData\Local\Temp\tmpC9A9.tmp", line 722, in <module>
    main()
    File "C:\Users\badia\AppData\Local\Temp\tmpC9A9.tmp", line 686, in main
    venv_site_packages_directory = subprocess.check_output([venv_python_executable, '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())']).strip()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\badia\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\badia\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['C:\\Users\\badia\\lib\\oracle-cli\\Scripts\\python', '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())']' returned non-zero exit status 1.


    From what I search this library is deprecated for this Python version, do you guys have any suggestion to solve this?

    python-3.12.1 distutils oci-cli

    Installing oci-cli in Python 3.12.1 but get error message like I provided.

    Continue reading...

Compartilhe esta Página