$ 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 --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
参考:
网友评论