python - macOS Sequoia:阅读 plist

问题描述 投票:0回答:1

尝试在 macOS sequoia 中读取 plist。我确实找到了 https://pypi.org/project/plists/#description 但它没有安装

如何使用 python plists 包?

pip3 安装 plists

出现以下错误:

Defaulting to user installation because normal site-packages is not writeable
Collecting plists
  Using cached plists-0.0.4.tar.gz (7.4 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/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'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-iufqpu7j
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/71/1b/24d3f3885744b41e4d58774bce89b3a20966960cd41c9d3d787485e01e1d/plists-0.0.4.tar.gz#sha256=d48b2390c27d957cf54791001f679f1c96d2652b599a85a3d9d2cc4567c02ce0 (from https://pypi.org/simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.3.tar.gz (6.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/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'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-qqjk06qw
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/f6/bf/d7e74c38a6d8d4993ac2631fc327c3439e06e7d01ebf54f86202393e548f/plists-0.0.3.tar.gz#sha256=c3ac16d5b6262552ac5da8ac410fa7a85e918e11ff708cf5b4958f240619029b (from https://pypi.org/simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.2.tar.gz (6.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/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'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-y01b3lan
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1f/38/e451a4895d12d241f2bca8061a2d5c4d376e2e90739d892977a1266e227f/plists-0.0.2.tar.gz#sha256=ed39b1dad1b0de1dfc4853e70c39bd7a14e5e3b7b86ad76c22754d49833976fd (from https://pypi.org/simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.1.tar.gz (6.2 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/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'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-8esq59jv
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/2b/67/18ade2a5d79733595d53a0ae174bdf11d28ac2f649db68b2377148291ad8/plists-0.0.1.tar.gz#sha256=3c452ad85861ada94f3199658c0fadd860a3c74388346e9c58ff74132807e893 (from https://pypi.org/simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement plists (from versions: 0.0.3.macosx-10.10-x86_64, 0.0.4.macosx-10.10-x86_64, 0.0.1, 0.0.2, 0.0.3, 0.0.4)
ERROR: No matching distribution found for plists
WARNING: You are using pip version 21.2.4; however, version 24.3.1 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.
python plist macos-sequoia
1个回答
0
投票

看来你的问题可能来自于你的pip3版本

21.2.4
,我建议你更新到版本
24.3.1

ERROR: Could not find a version that satisfies the requirement plists (from versions: 0.0.3.macosx-10.10-x86_64, 0.0.4.macosx-10.10-x86_64, 0.0.1, 0.0.2, 0.0.3, 0.0.4)
ERROR: No matching distribution found for plists

“我的假设”是你有你的Python库,而不是Homebrew。所以我建议你走虚拟环境路线

cd 进入你有 python3 的 venv 路径,我想它应该在这里

cd /Library/Developer/CommandLineTools/usr/bin

然后执行以下步骤

步骤1

sudo python3.13 -m venv path/to/venv

步骤2

source path/to/venv/bin/activate

步骤3

sudo python3.13 -m pip install --upgrade pip
pip install --upgrade pip

之后您可以继续安装 plists 包

pip3 install plists 

这应该能让你加快速度

© www.soinside.com 2019 - 2024. All rights reserved.