[英]How to install bokeh for Python3
I installed bokeh via pip and here is the information of the versions that are installed 我通过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
for python2, it works fine and could import bokeh 对于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
>>>
However, it complains when I use python3 但是,当我使用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'
>>>
I want to use bokeh in my Python3 Jupyter-Notebook and having problem cos of this, if any suggestions are available, please let me know. 我想在我的Python3 Jupyter-Notebook中使用bokeh并对此有问题的建议,如果有任何建议,请告诉我。
Many thanks, 非常感谢,
It will sound trivial but you need to install both (jupyter notebook and bokeh) under the same environment (virtual or not). 这听起来很琐碎,但您需要在相同的环境(虚拟或非虚拟)下同时安装(jupyter笔记本电脑和bokeh)。
If you installed jupyter notebook using a snippet from the jupyter's website ( pip3 install jupyter
) then you have it installed in a non-virtual environment and from what I've understood you are trying to import bokeh which is installed in a virtual one. 如果您是使用jupyter网站上的一个片段(
pip3 install jupyter
)安装了jupyter笔记本,那么您已将其安装在非虚拟环境中,并且据我了解,您正在尝试导入安装在虚拟环境中的bokeh。
There are two solutions: 有两种解决方案:
You run everything under non-virtual environment ( which is probably not the best/cleanest choice ): 您可以在非虚拟环境下运行所有内容( 这可能不是最佳/最干净的选择 ):
pip3 install jupyter
pip3 install jupyter
笔记本pip3 install jupyter
pip3 install bokeh
pip3 install bokeh
jupyter notebook
( without activating virtual environment ) jupyter notebook
启动jupyter notebook
( 不激活虚拟环境 ) You run everything under virtual environment: 您可以在虚拟环境下运行所有内容:
python -m pip install jupyter
python -m pip install jupyter
python -m pip install bokeh
python -m pip install bokeh
jupyter notebook
jupyter notebook
启动jupyter notebook
I had the same problem here. 我在这里有同样的问题。 Apparently, there are some problems with
pip
installation. 显然,
pip
安装存在一些问题。 I solved my problem with re-installing bokeh
with conda
. 我通过用
conda
重新安装bokeh
解决了我的问题。
You can have both a different version of pip
together ( pip2
, pip3
). 您可以同时拥有两个不同版本的
pip
( pip2
, pip3
)。
And pip
can be linked to whether pip2/python2
or pip3/python3
. pip
可以链接到pip2/python2
还是pip3/python3
。
For me pip
is for Python 3.x , pip2
is for Python 2.7 and pip3
is for Python 3.x : 对我而言,
pip
适用于Python 3.x , pip2
适用于Python 2.7 , pip3
适用于Python 3.x :
$ pip -V
pip 9.0.3 from /usr/local/lib/python3.6/dist-packages/pip-9.0.3-py3.6.egg (python 3.6)
$ pip2 -V
pip 10.0.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip3 -V
pip 9.0.3 from /usr/local/lib/python3.6/dist-packages/pip-9.0.3-py3.6.egg (python 3.6)
$ python -V
Python 2.7.12
$ python3 -V
Python 3.6.6
In this case, you should install bokeh for both versions of Python: 在这种情况下,您应该为两个版本的Python安装bokeh :
sudo pip3 install bokeh
sudo pip2 install bokeh
$ 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
Python 3.6.6 (default, Jun 28 2018, 04:42:43)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bokeh
>>>
[ NOTE ]: [ 注意 ]:
Refer to the following links to install both versions of pip
: 请参考以下链接以安装两个版本的
pip
:
You can also use conda
instead of virtual-env
and pip
. 您也可以使用
conda
代替virtual-env
和pip
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.