美文网首页
ubuntu 安装 Jupyter Notebook

ubuntu 安装 Jupyter Notebook

作者: iOSDevLog | 来源:发表于2019-03-11 00:22 被阅读2次
$ sudo apt install python3
$ sudo apt install python3-pip
$ pip3 install --upgrade pip
$ pip3 install jupyter
Traceback (most recent call last):
  File "/usr/bin/pip3", line 13, in <module>
    sys.exit(__main__.main())
AttributeError: module 'pip.__main__' has no attribute 'main'
$ whereis pip3
pip3: /usr/bin/pip3 /usr/share/man/man1/pip3.1.gz
$ sudo vim /usr/bin/pip3

from pip import main
if __name__ == '__main__':
    sys.exit(main())

改为:

···
from pip import main
if name == 'main':
sys.exit(main._main())


改好之后的文件内容如下:

···
#!/usr/bin/python3
# GENERATED BY DEBIAN

import sys

# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
# from pip import main
from pip import __main__
if __name__ == '__main__':
    # sys.exit(main())
    sys.exit(__main__._main())
···

权限不够,用 `--user` 选项安装

pip3 install jupyter Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/ipython_genutils' Consider using the `--user` option or check the permissions. pip3 install jupyter --user
..
The scripts jupyter-bundlerextension, jupyter-nbextension, jupyter-notebook and jupyter-serverextension are installed in '/home/xxx/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
...

添加路径

$ echo 'export PATH=/home/xxx/.local/bin:$PATH' >> ~/.bashrc、
$ source ~/.bashrc
$ jupyter notebook

参考:

Installing Jupyter Notebook

相关文章

网友评论

      本文标题:ubuntu 安装 Jupyter Notebook

      本文链接:https://www.haomeiwen.com/subject/pvpmpqtx.html