9
votes

Python ne peut pas installer Box2D swig.exe a échoué avec le code d'erreur 1

J'essaye d'installer Box2D sur python mais j'obtiens le journal des erreurs:

C:\>pip3 install Box2D
Collecting Box2D
  Using cached https://files.pythonhosted.org/packages/cc/7b/ddb96fea1fa5b24f8929714ef483f64c33e9649e7aae066e5f5023ea426a/Box2D-2.3.2.tar.gz
Building wheels for collected packages: Box2D
  Running setup.py bdist_wheel for Box2D ... error
  Complete output from command c:\users\hp-laptop\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\HP-LAP~1\\AppData\\Local\\Temp\\pip-install-r48_7g5v\\Box2D\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\HP-LAP~1\AppData\Local\Temp\pip-wheel-d2ghuwrx --python-tag cp36:
  Using setuptools (version 40.5.0).
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\Box2D
  copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.6\Box2D
  copying library\Box2D\__init__.py -> build\lib.win-amd64-3.6\Box2D
  creating build\lib.win-amd64-3.6\Box2D\b2
  copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.6\Box2D\b2
  running build_ext
  building 'Box2D._Box2D' extension
  swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
  C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
  C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\Lib\pyprimtypes.swg(7) : Error: Syntax error in input(1).
  error: command 'C:\\Users\\HP-Laptop\\AppData\\Local\\Programs\\Python\\Python36\\swig.exe' failed with exit status 1

  ----------------------------------------
  Failed building wheel for Box2D
  Running setup.py clean for Box2D
Failed to build Box2D
Installing collected packages: Box2D
  Running setup.py install for Box2D ... error
    Complete output from command c:\users\hp-laptop\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\HP-LAP~1\\AppData\\Local\\Temp\\pip-install-r48_7g5v\\Box2D\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\HP-LAP~1\AppData\Local\Temp\pip-record-nv5dm4ru\install-record.txt --single-version-externally-managed --compile:
    Using setuptools (version 40.5.0).
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\Box2D
    copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.6\Box2D
    copying library\Box2D\__init__.py -> build\lib.win-amd64-3.6\Box2D
    creating build\lib.win-amd64-3.6\Box2D\b2
    copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.6\Box2D\b2
    running build_ext
    building 'Box2D._Box2D' extension
    swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
    C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
    C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\Lib\pyprimtypes.swg(7) : Error: Syntax error in input(1).
    error: command 'C:\\Users\\HP-Laptop\\AppData\\Local\\Programs\\Python\\Python36\\swig.exe' failed with exit status 1

    ----------------------------------------
Command "c:\users\hp-laptop\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\HP-LAP~1\\AppData\\Local\\Temp\\pip-install-r48_7g5v\\Box2D\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\HP-LAP~1\AppData\Local\Temp\pip-record-nv5dm4ru\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\HP-LAP~1\AppData\Local\Temp\pip-install-r48_7g5v\Box2D\

J'ai essayé toutes les solutions pour Windows depuis Installation du module pocketphinx python: la commande 'swig.exe' a échoué sans résultat.

Comment puis-je installer Box2D et que signifie le code d'erreur 1 par swig?


0 commentaires

3 Réponses :


3
votes

téléchargez swig ici: http://www.swig.org/download.html

Extrayez l'archive quelque part, ajoutez le chemin du répertoire extrait à votre variable d'environnement PATH.

Redémarrez la fenêtre de votre console cmd (fermez-la et rouvrez-la), faites votre pip install Box2D

Je dois dire que lorsque vous êtes dans l'environnement anaconda, ajoutez simplement un chemin, cela ne fonctionne pas non plus. nous devons aller sur les scripts avec pip.exe. Et exécutez la commande!


0 commentaires

2
votes

J'ai eu la même erreur pour Box2D.
Ma solution- téléchargement du compilateur Microsoft Visual C ++ pour Python 2.7 à partir de http://aka.ms/vcpython27 Terminez l'installation.
Puis à l'invite anaconda tapez la commande 'pip install Box2D'
Tapez ensuite "pip install gym [all]"
Cela installera les dépendances restantes.

J'espère que cela vous aidera.


0 commentaires

6
votes

J'ai eu la même erreur pour Box2D, mais résolu comme suit.

J'utilise l'environnement Anaconda avec python3.6.

essayez-les.

conda install swig

pip install box2d


0 commentaires