macOS Catalina上python调用摄像头权限问题

macOS Catalina上python调用摄像头权限问题

  1. xcode
    1)打开Xcode,新建项目,选择macOS,App。
    2)完善项目信息:
    Product Name: pycharm
    Organization Identifier: com.jetbrains
    Bundle identifier: com.jetbrains.pycharm
    Language: Swift
    User Interface: Storyboard
    3)打开Info.plist文件 ,添加Privacy – Camera Usage Description,属性为:Give me my camera access!
    4)打开AppDelegate.swift文件,导入库新增:
    import AVKit
    5)applicationDidFinishLaunching() 函数中,添加代码:
    AVCaptureDevice.requestAccess(for: .video) { _ in }

然后运行项目,OK允许

  1. Iterm2
    系统当前 shell
    $ cat /etc/shells
    当前使用的shell
    echo $SHELL
    切换到zsh
    chsh -s /bin/zsh

bash的配置文件是 -/.bash_profile
zsh的配置文件是-/.zshrc

安装iTerm2
iTerm2下载地址:https://www.iterm2.com/downloads.html
brew cask install iterm2

安装oh my zsh
通过curl安装:
sh -c “$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”
或通过wget安装:
sh -c “$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)

‘/Applications/IntelliJ IDEA.app/Contents/MacOS/idea’

You must be logged in to post a comment