ubuntu 22.04系统中报错:Python 3.6 is no longer supported by the Python core team...解决方式

2023-06-01 00:00:00 报错 方式 解决

今天我在ubuntu 22.04中执行一下:docker-compose --version命令报以下错误:

[email protected]:~# docker-compose --version
/snap/docker/2746/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
  from cryptography.hazmat.backends import default_backend
docker-compose version 1.29.2, build unknown

/snap/docker/2746/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.

  from cryptography.hazmat.backends import default_backend


原因:

这是属于加密弃用警告:Python核心团队不再支持Python 3.6

我上网查了一下,有说降级,升级的


不过我用不到python其他的功能,只是一个docker-compose的依赖

解决思路:

docker-compose必须为2.X,之后您需要将旧命令引用到新命令


解决方式:

做一个别名,执行以下命令

alias docker-compose='docker compose'

就ok了


重新执行命令报错就没了

[email protected]:~# alias docker-compose='docker compose'
[email protected]:~# docker-compose --version
Usage:  docker compose [OPTIONS] COMMAND
Docker Compose
Options:
      --ansi string                Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
      --compatibility              Run compose in backward compatibility mode
      --env-file string            Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the Compose file)
  -p, --project-name string        Project name
Commands:
  build       Build or rebuild services
  convert     Converts the compose file to platform's canonical format
  cp          Copy files/folders between a service container and the local filesystem
  create      Creates containers for a service.
  down        Stop and remove containers, networks
  events      Receive real time events from containers.
  exec        Execute a command in a running container.
  images      List images used by the created containers
  kill        Force stop service containers.
  logs        View output from containers
  ls          List running compose projects
  pause       Pause services
  port        Print the public port for a port binding.
  ps          List containers
  pull        Pull service images
  push        Push service images
  restart     Restart containers
  rm          Removes stopped service containers
  run         Run a one-off command on a service.
  start       Start services
  stop        Stop services
  top         Display the running processes
  unpause     Unpause services
  up          Create and start containers
  version     Show the Docker Compose version information
Run 'docker compose COMMAND --help' for more information on a command.
[email protected]:~# 

相关文章