web-dev-qa-db-fra.com

CryptographyDePrecationAnning: Python 2 n'est plus supporté par le Python équipe de base

J'essaie de courir docker-compose (qui a été installé via pip), encore une erreur suivante:

# pip install --quiet docker-compose
# docker-compose ps
/usr/local/lib/python2.7/dist-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
  from cryptography.hazmat.backends import default_backend
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 7, in <module>
    from compose.cli.main import main
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 24, in <module>
    from ..config import ConfigurationError
  File "/usr/local/lib/python2.7/dist-packages/compose/config/__init__.py", line 6, in <module>
    from .config import ConfigurationError
  File "/usr/local/lib/python2.7/dist-packages/compose/config/config.py", line 51, in <module>
    from .validation import match_named_volumes
  File "/usr/local/lib/python2.7/dist-packages/compose/config/validation.py", line 12, in <module>
    from jsonschema import Draft4Validator
  File "/usr/local/lib/python2.7/dist-packages/jsonschema/__init__.py", line 21, in <module>
    from jsonschema._types import TypeChecker
  File "/usr/local/lib/python2.7/dist-packages/jsonschema/_types.py", line 3, in <module>
    from pyrsistent import pmap
  File "/usr/local/lib/python2.7/dist-packages/pyrsistent/__init__.py", line 3, in <module>
    from pyrsistent._pmap import pmap, m, PMap
  File "/usr/local/lib/python2.7/dist-packages/pyrsistent/_pmap.py", line 98
    ) from e
         ^
SyntaxError: invalid syntax
# 

# cat /etc/debian_version 
9.13
# python2 --version
Python 2.7.13
# python3 --version
Python 3.5.3
# 

Y a-t-il un moyen de forcer docker-compose Pour utiliser Python3 au lieu de python (python2)?


@Micromegas/@mikaelh

# apt-get -q install python3-pip
# pip3 install --quiet docker-compose
# docker-compose ps
/usr/local/lib/python3.5/dist-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release ofcryptography. Please upgrade your Python.
  from cryptography.hazmat.backends import default_backend
Name   Command   State   Ports
------------------------------
# 
6
alexus

Comme Python 2 est maintenant fin de vie, le Python 3= version de pip doit être utilisé pour installer Docker-Compose. Sur Debian ou Ubuntu il peut être installé avec:

apt-get install python3-pip

Ensuite, le Python 3 la version PIP peut être utilisé pour installer Docker Compose

pip3 install docker-compose
2
daiwai