为什么 sudo pip 没有创建这个错误消息?

为什么 sudo pip 没有创建这个错误消息?

我尝试使用以下命令安装 ipython:

nlp@nlp-server:~/dialog$ pip install ipython

Collecting ipython
  Using cached https://files.pythonhosted.org/packages/46/b5/ca080401b8dbde51a0f4377b4e22ce02b266340a1cda389b6dea702d06d1/ipython-7.4.0-py3-none-any.whl
Collecting backcall (from ipython)
Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/lib/python3/dist-packages (from ipython) (4.2.1)
Requirement already satisfied: setuptools>=18.5 in /usr/lib/python3/dist-packages (from ipython) (39.0.1)
Collecting prompt-toolkit<2.1.0,>=2.0.0 (from ipython)
  Using cached https://files.pythonhosted.org/packages/f7/a7/9b1dd14ef45345f186ef69d175bdd2491c40ab1dfa4b2b3e4352df719ed7/prompt_toolkit-2.0.9-py3-none-any.whl
Collecting decorator (from ipython)
  Using cached https://files.pythonhosted.org/packages/5f/88/0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl
Collecting pickleshare (from ipython)
  Using cached https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
Collecting jedi>=0.10 (from ipython)
  Using cached https://files.pythonhosted.org/packages/25/2b/1f188901be099d52d7b06f4d3b7cb9f8f09692c50697b139eaf6fa2928d8/jedi-0.13.3-py2.py3-none-any.whl
Collecting pygments (from ipython)
  Using cached https://files.pythonhosted.org/packages/13/e5/6d710c9cf96c31ac82657bcfb441df328b22df8564d58d0c4cd62612674c/Pygments-2.3.1-py2.py3-none-any.whl
Collecting traitlets>=4.2 (from ipython)
  Using cached https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython) (1.11.0)
Collecting wcwidth (from prompt-toolkit<2.1.0,>=2.0.0->ipython)
  Using cached https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Collecting parso>=0.3.0 (from jedi>=0.10->ipython)
  Using cached https://files.pythonhosted.org/packages/a7/bd/e2f4753c5fa93932899243b4299011a757ac212e9bc8ddf062f38df4e78b/parso-0.4.0-py2.py3-none-any.whl
Collecting ipython-genutils (from traitlets>=4.2->ipython)
  Using cached https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Installing collected packages: backcall, wcwidth, prompt-toolkit, decorator, pickleshare, parso, jedi, pygments, ipython-genutils, traitlets, ipython
**Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/backcall'
Consider using the `--user` option or check the permissions.**

我认为这是一个用户权限问题,然后我使用了这个命令:

nlp@nlp-server:~/dialog$ sudo pip install ipython
sudo: pip: command not found

如何解决这个问题?

答案1

要在基于 Debian 和基于 .rpm 的发行版中安装 IPython for Python 2.x,请打开终端并输入:

sudo apt install ipython # for Debian-based distros

或者:

sudo yum install python-ipython

或者:

sudo dnf install python-ipython

我强烈建议您习惯将 IPython 与 Python 3 结合使用。要在基于 Debian 和基于 .rpm 的发行版中安装适用于 Python 3.x 的 IPython,请打开终端并输入:

sudo apt install ipython3 # for Debian-based distros

或者:

sudo yum install python3-ipython 

或者:

sudo dnf install python3-ipython 

相关内容