M1下使用Python安装库失败情况

M1 电脑上,Python环境一塌糊涂;

当使用pip安装时,出现警告如下:

WARNING: The directory '/Users/xxx/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.

意思是让你每次sudo 都要带上-H参数,太麻烦了;
使用命令:

sudo chown -R xxx /Users/xxx/Library/Caches/pip

只能临时解决问题,并不能根治;

使用pip安装frida时,出现错误:

  × Running setup.py install for frida did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-3.10
      creating build/lib.macosx-10.9-universal2-3.10/frida
      copying frida/__init__.py -> build/lib.macosx-10.9-universal2-3.10/frida
      copying frida/core.py -> build/lib.macosx-10.9-universal2-3.10/frida
      running build_ext
      looking for prebuilt extension in home directory, i.e. /Users/weiyansheng/frida-15.1.22-py3.10-macosx-11.0-arm64.egg
      prebuilt extension not found in home directory, will try downloading it
      querying pypi for available prebuilds
      using default index URL: https://pypi.org/simple/
      downloading package list from https://pypi.org/simple/frida/
      unable to download it within 20 seconds; please download it manually to /Users/weiyansheng/frida-15.1.22-py3.10-macosx-11.0-arm64.egg
      error: 
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> frida

主要是SSL证书未配置;
找到Python对应版本地下的Install Certificates.command,运行命令行:

/Applications/Python\ 3.10/Install\ Certificates.command

你可能感兴趣的:(M1下使用Python安装库失败情况)