【问题标题】:Lack of permissions in WindowsWindows 中缺少权限
【发布时间】:2023-03-16 07:05:01
【问题描述】:

我创建了 C:/Users/homedir/Documents/Python。窗口自动 将其放在 OneDrive 的路径中。这会导致权限错误吗?

d@LAPTOP-M0R87BQ6 MINGW64 ~/OneDrive/Documents/Python/twilio-python-main (main)
$ python3 setup.py install
running install
error: can't create or remove files in install directory

# The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-9920.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\Lib\site-packages\

我需要创建目录(或修改 setup.py 以安装在 Python 的其他路径中)的唯一问题吗?

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  

我是这台机器的管理员,我在组管理员中。我的机器上没有更高的根。我以管理员身份打开了 PowerShell 并运行了 python 解释器。权限还是不够。查看 Windows 资源管理器,我是所有文件的所有者。

错误提示:“如果您没有对此机器的管理访问权限,您可能希望选择不同的安装目录,最好是 PYTHON PATH 环境变量中列出的目录。”

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.

【问题讨论】:

    标签: python-3.x windows powershell


    【解决方案1】:

    在 cmd 窗口中尝试获取 WindowsApps 文件夹的所有权,并确保属性被其子文件夹继承

    takeown /f \"C:\Program Files\WindowsApps" && icacls \"C:\Program Files\WindowsApps" /grant administrators:F
    

    【讨论】:

      猜你喜欢
      • 2023-03-06
      • 1970-01-01
      • 2021-01-01
      • 2020-09-19
      • 1970-01-01
      • 1970-01-01
      • 2021-12-31
      • 2021-08-24
      • 1970-01-01
      相关资源
      最近更新 更多