Fla*_*air 5 permissions python ipython software-installation pip
当我使用
pip install ipython
Run Code Online (Sandbox Code Playgroud)
或者
pip install "ipython[notebook]"
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Downloading/unpacking ipython
Downloading ipython-2.3.1-py27-none-any.whl (2.8MB): 2.8MB downloaded
Installing collected packages: ipython
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber
os.makedirs(destsubdir)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/IPython'
Storing debug log for failure in /home/username/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)
这个错误是什么意思?我如何解决它?
您可以同时安装来自默认 Ubuntu 存储库的默认 IPython 版本和 IPython 2.3.1。
使用以下命令从默认的 Ubuntu 存储库安装 IPython:
sudo apt-get install ipython ipython3 # ipython is available in 18.04 and earlier
Run Code Online (Sandbox Code Playgroud)
在虚拟环境中安装 IPython 2.3.1。virtualenv允许您创建一个沙盒和隔离的环境,在该环境中可以安装 Python 包,而不会干扰同一台机器上的其他包。安装 Python 虚拟环境创建器(virtualenv):
sudo apt-get install python-virtualenv virtualenv
Run Code Online (Sandbox Code Playgroud)
为 Python 设置一个虚拟环境(有关 virtualenv 基本用法的信息),从终端激活您的 Python 虚拟环境,然后使用pip install.
pip install --user ipython
Run Code Online (Sandbox Code Playgroud)
这适用于我的 Ubuntu 14.04,使用来自默认 Ubuntu 存储库的 IPython 和安装在 Python 虚拟环境 ( virtualenv ) 中的IPython 2.3.0 。