导入pyexcel-xlx时出错

时间:2017-04-07 14:04:38

标签: python flask

你好我正在使用pythonanywhere.com为我的网络应用程序,我正在寻找一种方法导入pyexcel让我使用,但似乎我不能这样做,因为这个错误。我是网络应用程序开发的新手。所以,请。我需要你的帮助。

当我通过从github克隆它来安装它时,它做到了这一点:

    $ git clone http://github.com/pyexcel/pyexcel-xlsx.git
    $ cd pyexcel-xlsx
    $ python setup.py install

但我在这里遇到了错误:

13:56 ~ $ git clone http://github.com/pyexcel/pyexcel-xlsx.git
Cloning into 'pyexcel-xlsx'...
remote: Counting objects: 808, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 808 (delta 1), reused 0 (delta 0), pack-reused 801
Receiving objects: 100% (808/808), 167.27 KiB | 0 bytes/s, done.
Resolving deltas: 100% (473/473), done.
Checking connectivity... done.
13:56 ~ $ cd pyexcel-xlsx
13:57 ~/pyexcel-xlsx (master)$ python setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
    [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-22208.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
    /usr/local/lib/python2.7/dist-packages/
Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
  https://setuptools.readthedocs.io/en/latest/easy_install.html
Please make the appropriate changes for your system and try again.

2 个答案:

答案 0 :(得分:1)

因为您使用的是PythonAnywhere的标准Python,而不是构建虚拟环境(由您控制​​)setup.py正在尝试安装到系统site-packages目录中,您只有读权限。如果您想在没有虚拟环境的情况下继续,请在您自己的区域中创建一个目录,并告诉setup.py使用--install-lib dirname选项将其安装在那里。

然后使用PYTHONPATHexport PYTHONPATH=dirname shell环境变量设置为该目录,以便解释器将该目录添加到其模块搜索路径中,您应该好好去。

答案 1 :(得分:0)

@ holdenweb的说明很好,但更快的方法就是在bash控制台中运行它:

pip2.7 install --user https://github.com/pyexcel/pyexcel-xlsx/archive/master.zip