【问题标题】:Starting WebIOPi with Python 2 instead of Python 3使用 Python 2 而不是 Python 3 启动 WebIOPi
【发布时间】:2017-10-03 00:47:13
【问题描述】:

我必须使用 WebIOPi 运行一个 python 脚本,其中包括用于电报机器人的 Telepot。问题是我只能将 Telepot 与 Python2.7 一起使用,但 WebIOPi 使用 Python 3.4。我该如何解决这个问题?

【问题讨论】:

    标签: python-2.7 raspberry-pi3 webiopi


    【解决方案1】:

    我解决了在 setup.sh 文件中用 python2.7 替换 python3 的问题。我的案例我使用了 webiopi-0.7.1

      wget WebIOPi-x.y.z.tar.gz
    $ tar xvzf WebIOPi-x.y.z.tar.gz
    $ cd WebIOPi-x.y.z
    $ sed -i 's/ python3/python2.7/' setup.sh
    $ sudo ./setup.sh
    $ sudo service webiopi restart
    

    【讨论】:

      【解决方案2】:

      试试这个 -

      第 3 步:使用 Python 2.7 安装 WebIOPi

      默认情况下,WebIOPi 使用 Python 3 自行安装。不幸的是,Python 3 并未被广泛采用,许多开发人员更喜欢在 Python 2.7 中工作——我们将用于 DHT11 的驱动程序需要 Python 2.7。

      使用 Python 2.7 安装 WebIOPi 很简单,我们只需要从 setup.sh 的第四行中删除“python3”:

      $ wget WebIOPi-x.y.z.tar.gz
      $ tar xvzf WebIOPi-x.y.z.tar.gz
      $ cd WebIOPi-x.y.z
      $ sed -i 's/ python3//' setup.sh
      $ sudo ./setup.sh
      $ sudo webiopi-passwd
      $ sudo service webiopi restart
      

      【讨论】:

        猜你喜欢
        • 2019-10-04
        • 2016-11-19
        • 2017-03-18
        • 2015-11-01
        • 1970-01-01
        • 2020-11-03
        • 2020-09-24
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多