首页 > 解决方案 > How to change Python version used by Bokeh?

问题描述

When I launch my Python application I use the command: bokeh serve application.py

This was working before on a Windows machine where only one Python version existed.

Now I am on a Linux machine where I have Python (version 2.7) and Python3 (version 3.4).

There is some native stuff on Linux using Python 2.7 so I cannot rename Python3 to Python.

Is there a way to tell Bokeh to use another Python version? If I do Bokeh info indeed says that the Python version is 2.7.

标签: pythonlinuxpython-2.7python-3.4bokeh

解决方案


Bokeh 不“使用” Python 版本。Bokeh 安装在 Python 环境中,当您bokeh serve从相应环境运行 Python 版本时,将使用该版本。这就是 Python 的一般工作方式,Bokeh 无法表现出不同的行为。

最可能的解释是您有多个 Python 环境,而 Python 2.7 环境首先在您的系统上PATH。确保将 Bokeh 安装到 Python 3 环境中(即安装到它的site-packages)中,并确保binPython 3 环境的目录首先位于您的路径中(或通过提供正确路径的完整绝对路径来运行 Bokeh 服务器)。

或者,您可以使用以下命令运行 Bokeh 服务器-m

python -m bokeh serve app.py

在这种情况下,您可以直接控制使用哪个 Python 可执行文件。


推荐阅读