我无法安装"google-cloud-sdk"看到这个错误
和我遵循https://cloud.google.com/sdk/docs/install#deb
的指示ubuntu@ubuntu:~$ cat /etc/issue
Ubuntu 14.04.5 LTS
ubuntu@ubuntu:~$ sudo apt-get install google-cloud-sdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
google-cloud-sdk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up google-cloud-sdk (356.0.0-0) ...
ERROR: gcloud failed to load: No module named 'typing'
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import display
from googlecloudsdk.calliope import display_taps
from googlecloudsdk.core.resource import resource_printer_base
from googlecloudsdk.core.resource import resource_projector
import proto # pylint: disable=g-import-not-at-top
from .enums import Enum
from proto.marshal.rules.enums import EnumRule
from typing import Type
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
/usr/bin/python3
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
https://cloud.google.com/sdk/
dpkg: error processing package google-cloud-sdk (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
google-cloud-sdk
E: Sub-process /usr/bin/dpkg returned an error code (1)
"typing"模块如下所示:
ubuntu@ubuntu:~$ python3
Python 3.4.3 (default, Nov 12 2018, 22:25:49)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
> import typing
> >>> from typing import Type
> >>> print(typing.__file__)
> /usr/local/lib/python3.4/dist-packages/typing.py
> >>>
为什么不工作?
设置"CLOUDSDK_PYTHON_SITEPACKAGES=1"环境变量worked
ubuntu@ubuntu:~$ export CLOUDSDK_PYTHON_SITEPACKAGES=1
ubuntu@ubuntu:~$ sudo -E apt-get install google-cloud-sdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
google-cloud-sdk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up google-cloud-sdk (356.0.0-0) ...
components post-process --force-recompile
WARNING: Python 3.4.x is no longer officially supported by the Google Cloud SDK
and may not function correctly. Please use Python version 2.7.x or 3.5 and up.
If you have a compatible Python interpreter installed, you can use it by setting
the CLOUDSDK_PYTHON environment variable to point to it.
ubuntu@ubuntu:~$ which gcloud
/usr/bin/gcloud