gpt4 book ai didi

python - 如何为 Python3 安装 Bokeh

转载 作者:行者123 更新时间:2023-12-02 00:28:48 29 4
gpt4 key购买 nike

我通过 pip 安装了 bokeh,这里是安装的版本信息

pooja@X1-Carbon-6:~$ python3 --version
Python 3.5.2
pooja@X1-Carbon-6:~$ python --version
Python 2.7.12
pooja@X1-Carbon-6:~$ bokeh --version
0.13.0

对于 python2,它工作正常并且可以导入 Bokeh

lkhr@X1-Carbon-6:~notebooks$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bokeh
>>>

但是,当我使用 python3 时它会报错

olkhr@X1-Carbon-6:~$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bokeh
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'bokeh'
>>>

我想在我的 Python3 Jupyter-Notebook 中使用 bokeh,但由于这个问题,如果有任何建议,请告诉我。

非常感谢,

最佳答案

这听起来微不足道,但您需要在同一环境(虚拟或非虚拟)下安装两者(jupyter notebook 和 bokeh)。

如果您使用 jupyter's website 中的片段安装了 jupyter 笔记本(pip3 install jupyter) 然后你将它安装在非虚拟环境中,据我了解,你正在尝试导入安装在虚拟环境中的 bokeh。

有两种解决方法:

  1. 您在非虚拟 环境下运行一切(这可能不是最好/最干净的选择):

    • 使用 pip3 install jupyter 安装笔记本
    • 使用 pip3 install bokeh 安装 bokeh
    • 使用 jupyter notebook 启动笔记本(不激活虚拟环境)
  2. 你在虚拟环境下运行一切:

    • 激活您的虚拟环境
    • 使用 python -m pip install jupyter 安装笔记本
    • 使用 python -m pip install bokeh 安装 bokeh
    • 使用 jupyter notebook 启动笔记本

关于python - 如何为 Python3 安装 Bokeh ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52734736/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com