如何使用 pip3 安装 ipython?

如何使用 pip3 安装 ipython?

我刚刚做了以下操作,没有任何问题:

brew install python3

pip3 install numpy

pip3 install scipy

但尝试时:

pip3 install ipython

我得到:

Exception:
  Traceback (most recent call last):
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/basecommand.py", line 232, in main
      status = self.run(options, args)
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/commands/install.py", line 347, in run
      root=options.root_path,
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/req/req_set.py", line 549, in install
      **kwargs
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/req/req_install.py", line 751, in install
      self.move_wheel_files(self.source_dir, root=root)
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/req/req_install.py", line 960, in move_wheel_files
      isolated=self.isolated,
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/wheel.py", line 374, in move_wheel_files
      maker.make_multiple(['%s = %s' % kv for kv in console.items()])
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/_vendor/distlib/scripts.py", line 334, in make_multiple
      filenames.extend(self.make(specification, options))
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/_vendor/distlib/scripts.py", line 323, in make
      self._make_script(entry, filenames, options=options)
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/_vendor/distlib/scripts.py", line 227, in _make_script
      self._write_script(scriptnames, shebang, script, filenames, ext)
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/_vendor/distlib/scripts.py", line 201, in _write_script
      self._fileop.write_binary_file(outname, script_bytes)
    File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/_vendor/distlib/util.py", line 388, in write_binary_file
      with open(path, 'wb') as f:
  PermissionError: [Errno 13] Permission denied: '/usr/local/bin/ipcontroller'

为什么这不起作用?我该如何解决这些错误?

答案1

您可能没有/usr/local/bin目录的写入权限。要解决此问题,请运行

sudo pip3 install ipython

您需要输入密码,假设您在计算机上拥有管理员权限。

答案2

您使用--user,除非您由于某种原因以超级用户 (su) 身份安装。

pip3 install --user ipython

https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-user

https://github.com/ipython/ipython/blob/master/README.rst

相关内容