命令行应用程序 shogle 需要 python3 但 Ubuntu 16 默认为 python 2.7
Command line application shoogle requires python3 but Ubuntu 16 defaults to python 2.7
命令行应用程序 shogle (https://github.com/tokland/shoogle) exposes google api 服务在终端命令行需要 python3 但是 ubuntu16默认python是2.7。
我已经尝试使用别名并从 python3 shell 中的子进程调用 shoogle 应用程序,但是(当然)os 仍然提供默认值。我一直不愿意对 .bashrc 或 PYTHONPATH 进行系统范围的更改,例如正如许多其他资源所期望的那样,2.7。但我目前在虚拟机上使用它,所以如果它坏了我可以恢复。这似乎是唯一的选择,但在生产环境中不切实际。
我在网上发现很少的 shoogle 帮助(作者建议 SO 等支持)所以如果有人有任何 shoogle 的经验或建议获得所需的 python 版本,我会很高兴听到。
运行 来自 python3 解释器的 shogle 找到 2.7 文件:
3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609]
Python Type "help", "copyright", "credits" or "license" for more information.
from subprocess import call
call (['shoogle', 'show'])
Traceback (most recent call last):
File "/usr/local/bin/shoogle", line 11, in <module>
import shoogle
File "/usr/local/lib/python2.7/dist-packages/shoogle/__init__.py", line 5,
in <module> from .shoogle import *
File "/usr/local/lib/python2.7/dist-packages/shoogle/shoogle.py", line 14, in <module>
from . import commands
File "/usr/local/lib/python2.7/dist-packages/shoogle/commands/__init__.py", line 2, in <module>
from . import execute
根据@Surest Texans 的建议,我卸载了 shoogle 应用程序并使用 pip3 install 重新安装。现在应用程序在从命令行调用时按预期工作。
命令行应用程序 shogle (https://github.com/tokland/shoogle) exposes google api 服务在终端命令行需要 python3 但是 ubuntu16默认python是2.7。
我已经尝试使用别名并从 python3 shell 中的子进程调用 shoogle 应用程序,但是(当然)os 仍然提供默认值。我一直不愿意对 .bashrc 或 PYTHONPATH 进行系统范围的更改,例如正如许多其他资源所期望的那样,2.7。但我目前在虚拟机上使用它,所以如果它坏了我可以恢复。这似乎是唯一的选择,但在生产环境中不切实际。
我在网上发现很少的 shoogle 帮助(作者建议 SO 等支持)所以如果有人有任何 shoogle 的经验或建议获得所需的 python 版本,我会很高兴听到。
运行 来自 python3 解释器的 shogle 找到 2.7 文件:
3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609]
Python Type "help", "copyright", "credits" or "license" for more information.
from subprocess import call
call (['shoogle', 'show'])
Traceback (most recent call last):
File "/usr/local/bin/shoogle", line 11, in <module>
import shoogle
File "/usr/local/lib/python2.7/dist-packages/shoogle/__init__.py", line 5,
in <module> from .shoogle import *
File "/usr/local/lib/python2.7/dist-packages/shoogle/shoogle.py", line 14, in <module>
from . import commands
File "/usr/local/lib/python2.7/dist-packages/shoogle/commands/__init__.py", line 2, in <module>
from . import execute
根据@Surest Texans 的建议,我卸载了 shoogle 应用程序并使用 pip3 install 重新安装。现在应用程序在从命令行调用时按预期工作。