auth_registrations_mapping 错误:在具有管理员访问权限的 cmd 上 pip install twilio 时无法创建

问题描述

注意:大多数类似问题的解决方案都表明,我重试了 CMD 管理员访问权限。我试过了,仍然无法安装并返回类似的错误

SoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\python39\site-packages\twilio\rest\api\v2010\account\sip\domain\auth_types\auth_registrations_mapping
    error: Could not create 'C:\Users\manoj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\python39\site-packages\twilio\rest\api\v2010\account\sip\domain\auth_types\auth_registrations_mapping\auth_registrations_credential_list_mapping.py': No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\manoj\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io,os,sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Users\\manoj\\AppData\\Local\\Temp\\pip-install-6lxfxplk\\twilio_26ffaa2a98754c52996da5165593b5ba\\setup.py'"'"'; __file__='"'"'C:\\Users\\manoj\\AppData\\Local\\Temp\\pip-install-6lxfxplk\\twilio_26ffaa2a98754c52996da5165593b5ba\\setup.py'"'"';f = getattr(tokenize,'"'"'open'"'"',open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' install --record 'C:\Users\manoj\AppData\Local\Temp\pip-record-ovyqxs5v\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\manoj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\python39\Include\twilio' Check the logs for full command output.

解决方法

这里是 Twilio 开发者布道者。

我相信您已经点击了 Windows path length limit of 260 characters,这就是该文件失败的原因。您可以通过 following the instructions in the Windows documentation here 启用更长的路径。

本质上,Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) 注册表项必须存在并设置为 1。然后,在重新启动后,您应该能够使用更长的路径并且您的安装应该会成功。