首页 > 解决方案 > 无法在 Debian 4.9 VM 上安装 python3.6

问题描述

我在 Google 云上运行 Debian VM (4.9.189-3+deb9u1)。我想在这个实例上运行一个脚本;该脚本在我的本地机器上运行良好(Mac OSX Mojave 10.14.6;python 3.6.8)。但是,当我在 VM 上运行它时,我收到一个错误,这似乎与我的 VM 在脚本需要 python 3.6+ 时运行 python 3.4 的事实有关。

这就是问题所在。当我运行python -V时,响应是Python 3.7.4。但是,当我尝试安装支持我要运行的脚本的库时

    pip3 install --user --upgrade -e 
    git+https://github.com/twintproject/twint.git@origin/master#egg=twint

我明白了

twint requires Python '>=3.6.0' but the running Python is 3.5.3.

我已尝试更改默认的python,如此处详述;这似乎不起作用——事实上,当我查询ls /usr/bin/python*. 任何人都可以就如何在此处进行操作提供一些建议吗?谢谢。

标签: python-3.xgoogle-cloud-platformvirtual-machinedebian-based

解决方案


似乎您有多个 Python 版本可用。如果python -V给你Python 3.7.4,你可以使用:

$ python -m pip install --user --upgrade -e git+https://github.com/twintproject/twint.git@origin/master#egg=twint

pip从同一个 Python 解释器调用。


推荐阅读