[PYTHON] Vérifiez! Dépannage lors de l'installation de PyObjc sur Mac

Bonjour, c'est @dz_ ceci et Ohira Kazumi.

Prologue-Introduction

Je suis tombé sur une partie de l'installation de PyObjc pendant le processus, je vais donc garder un rappel.

#Présentez PyObjc (mise à jour)
$ pip install -U pyobjc

Environnement de travail

dépannage

tool'xcodebuild 'nécessite Xcode et une erreur

contenu de l'erreur

L'erreur est que xcodebuild demande Xcode lui-même au lieu de l'outil de ligne de commande.

$ sudo pip install -U pyobjc

Collecting pyobjc
  Using cached pyobjc-3.1.1.tar.gz
Collecting py2app>=0.10 (from pyobjc)
  Using cached py2app-0.10.tar.gz
Collecting pyobjc-core==3.1.1 (from pyobjc)
  Using cached pyobjc-core-3.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/pyobjc_core.egg-info
    writing include/pyobjc-compat.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-compat.h
    writing include/pyobjc-api.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-api.h
    writing pip-egg-info/pyobjc_core.egg-info/PKG-INFO
    writing namespace_packages to pip-egg-info/pyobjc_core.egg-info/namespace_packages.txt
    writing top-level names to pip-egg-info/pyobjc_core.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/pyobjc_core.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/pyobjc_core.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
    
    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
    Traceback (most recent call last):

...<Abréviation>...
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/lc/x_6095kd7xz1x7cjkp7vnmsm0000gp/T/pip-build-Aq79NE/pyobjc-core/

Faire face

Veuillez installer Xcode depuis le Mac App Store.

Erreur avec "Vous n'avez pas accepté les accords de licence Xcode"

contenu de l'erreur

Si vous obtenez l'erreur suivante, vous n'avez pas accepté la licence xcode.

$ sudo pip install -U pyobjc

Password:

Collecting pyobjc
  Downloading pyobjc-3.1.1.tar.gz
Collecting py2app>=0.10 (from pyobjc)
  Downloading py2app-0.10.tar.gz (1.7MB)
    100% |████████████████████████████████| 1.7MB 694kB/s 
Collecting pyobjc-core==3.1.1 (from pyobjc)
  Downloading pyobjc-core-3.1.1.tar.gz (2.2MB)
    100% |████████████████████████████████| 2.2MB 564kB/s 
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/pyobjc_core.egg-info
    writing include/pyobjc-compat.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-compat.h
    writing include/pyobjc-api.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-api.h
    writing pip-egg-info/pyobjc_core.egg-info/PKG-INFO
    writing namespace_packages to pip-egg-info/pyobjc_core.egg-info/namespace_packages.txt
    writing top-level names to pip-egg-info/pyobjc_core.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/pyobjc_core.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/pyobjc_core.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
    
    
    You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.

...<Abréviation>...

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-qqJvg7/pyobjc-core/

Faire face

Acceptez la licence avec xcodebuild.

#Acceptez la licence Xcode
$ sudo xcodebuild -license

Password:


You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

Si vous appuyez sur la touche «Entrée» ici, le contrat de licence sera affiché, utilisez donc la touche «espace» pour lire jusqu'en bas.

...<Abréviation>...

By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]

Lorsque vous voyez cela, tapez «d'accord» pour terminer l'acceptation de la licence.

You can view the license agreements in Xcode's About Box, or at /Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf

Erreur dans pyobjc-framework-AVKit

contenu de l'erreur

$ sudo pip install -U pyobjc

Password:

Collecting pyobjc
  Downloading pyobjc-3.1.1.tar.gz
Collecting py2app>=0.10 (from pyobjc)
  Downloading py2app-0.10.tar.gz (1.7MB)
    100% |████████████████████████████████| 1.7MB 562kB/s 
Collecting pyobjc-core==3.1.1 (from pyobjc)
  Downloading pyobjc-core-3.1.1.tar.gz (2.2MB)
    100% |████████████████████████████████| 2.2MB 595kB/s 
Collecting pyobjc_framework-AVKit==3.1.1 (from pyobjc)
  Downloading pyobjc-framework-AVKit-3.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-8BPKlF/pyobjc-framework-AVKit/setup.py", line 35, in <module>
        if fn.startswith('_AVKit')
      File "pyobjc_setup.py", line 496, in setup
        **k
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 239, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 263, in fetch_build_eggs
        parse_requirements(requires), installer=self.fetch_build_egg
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 580, in resolve
        raise VersionConflict(dist,req) # XXX put more info here
    pkg_resources.VersionConflict: (pyobjc-core 2.5.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC), Requirement.parse('pyobjc-core>=3.1.1'))
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-8BPKlF/pyobjc-framework-AVKit/

Analyse de cause

        raise VersionConflict(dist,req) # XXX put more info here
    pkg_resources.VersionConflict: (pyobjc-core 2.5.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC), Requirement.parse('pyobjc-core>=3.1.1'))

Apparemment, la version de pyobjc-core a la version 2.5.1 installée, mais la version 3.1.1 est requise.

Faire face

#Afficher une liste des packages installés par pip
$ pip list

...<Abréviation>...

pyobjc-core (2.5.1)

...<Abréviation>...

J'ai essayé de mettre à jour explicitement avec sudo pip install -U pyobjc-core, mais c'était [Errno 1] Opération non autorisée et n'a pas pu être téléchargé.

Par conséquent, j'ai explicitement installé python autre que le système par défaut pour le gérer. Pour la gestion des versions de chaque langue, ʻanyenv` est recommandé. (Référence: Utiliser phpenv avec Check! Anyenv (Mac OS X))

#Vérifier la version de python
$ python --version
Python 2.7.10

#Vérifiez la version de pip
$ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)

#Installez pyenv en utilisant anyenv
$ anyenv install pyenv

#Recharger la coque
$ exec $SHELL -l

# python 3.5.2 installer
$ pyenv install 2.7.12

#Vérifiez la version installée
$ pyenv versions
* system (set by /Users/user/.anyenv/envs/pyenv/version)
  2.7.12

# python 2.7.Activer 12
$ pyenv global 2.7.12

#mise à jour de pip
$ pip install --upgrade pip

Quand j'ai installé pyobjc-core dans cet état, cela s'est terminé normalement.

# pyobjc-installation de base
$ pip install -U pyobjc-core
Collecting pyobjc-core
  Using cached pyobjc-core-3.1.1.tar.gz
Installing collected packages: pyobjc-core
  Running setup.py install for pyobjc-core ... done
Successfully installed pyobjc-core-3.1.1

Il n'y a aucun problème si vous installez (mettez à jour) pyobjc lui-même au lieu de pyobjc-core ici.

Épilogue-Conclusion

En fait, c'est un dépannage en essayant de mettre pyBluez sur le Mac, mais même si j'efface l'installation de PyObjc, l'essentiel pyBluez a le problème suivant Je n'ai pas pu l'installer ... Cela s'est terminé au milieu de mon ambition. (À propos, le problème avec pyBluez a été corrigé et apparaîtra bientôt dans la version.)

Recommended Posts

Vérifiez! Dépannage lors de l'installation de PyObjc sur Mac
Remarques sur l'installation de dlib sur Mac
Remarques sur l'installation de pipenv sur votre Mac
Assistance lors de l'installation de l'oreiller sur python3.9
Erreur et solution lors de l'installation de python3 avec homebrew sur mac (catalina 10.15)
Résolution des erreurs lors de l'installation de numba sur macOS
Avertissement lors de l'utilisation de TensorFlow sur Mac
python sur mac
Vérifiez types_map lors de l'utilisation de mimetypes avec AWS Lambda (Python)
Étapes pour installer CUDA 7.5 avec Mac (El Capitan) + Homebrew
Installation de Python 3 sur Mac et vérification du fonctionnement de base Partie 1
Notes minimales lors de l'utilisation de Python sur Mac (édition pyenv)
Notes minimales lors de l'utilisation de Python sur Mac (édition Homebrew)
Installez Tensorflow sur Mac
Installez pyenv sur Mac
Trébuché lors de l'installation de PyOCR
Installez Ansible sur Mac
Installer Python 3 dans un environnement Mac
Remarques sur l'installation de PycURL
Installer des pandas sur python2.6
Exécutez OpenMVG sur Mac
Précautions lors de l'installation de fbprophet
Installez Python 3.4 sur Mac
Installation de pyenv sur ubuntu 16.04
Installez Caffe sur Mac
Installer mecab sur Mac
Essayez deepdream sur Mac
Précautions et solutions lors de l'installation d'Ubuntu sur un PC avec NVIDIA Gravo
(Note) Points auxquels il faut être accro lors de l'installation de Scilab sur ArchLinux