1

我正在尝试使用安装zipline模块,"pip install zipline"但出现此异常:

IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/editor.pyc'`  - any help would be greatly appreciated

Failed building wheel for numexpr
      Running setup.py clean for numexpr
    Failed to build numexpr
    Installing collected packages: python-editor, Mako, sqlalchemy, alembic, sortedcontainers, intervaltree, python-dateutil, numpy, numexpr, toolz, bottleneck, scipy, pytz, pandas, empyrical, requests, requests-file, requests-ftp, pandas-datareader, decorator, networkx, patsy, statsmodels, click, Logbook, multipledispatch, bcolz, Cython, contextlib2, cyordereddict, cachetools, zipline
    Exception:
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 342, in run
        prefix=options.prefix_path,
      File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 784, in install
        **kwargs
      File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 851, in install
        self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
      File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
        isolated=self.isolated,
      File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 345, in move_wheel_files
        clobber(source, lib_dir, True)
      File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 323, in clobber
        shutil.copyfile(srcfile, destfile)
      File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
        with open(dst, 'wb') as fdst:
    IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/editor.pyc'
4

2 回答 2

1

因为你不是root。您可以使用 sudo 获取超级用户权限:

sudo pip install zipline

要不然

对于 GNU/Linux:

在 Debian 派生的 Linux 发行版上,您可以通过运行以下命令从 apt 获取所有必要的二进制依赖项:

$ sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev

在最近的 RHEL 派生的 Linux 发行版(例如 Fedora)上,以下内容应该足以获得必要的附加依赖项:

$ sudo dnf install atlas-devel gcc-c++ gcc-gfortran libgfortran python-devel redhat-rep-config

在 Arch Linux 上,你可以通过 pacman 获取额外的依赖:

$ pacman -S lapack gcc gcc-fortran pkg-config

还有可用于安装 Python 3.4 的 AUR 包(Arch 的默认 python 现在是 3.5,但 Zipline 目前仅支持 3.4)和 ta-lib,一个可选的 Zipline 依赖项。Python 2 也可以通过以下方式安装:

$ pacman -S python2
于 2017-02-02T11:14:48.257 回答
0

避免sudo使用pip. 改用该--user选项,或者更好的是,使用虚拟环境。

看到这个答案。我认为这个问题是那个问题的重复。

于 2019-07-26T10:47:46.690 回答