【问题标题】:Some Confusion about easy_install without Root Access关于没有 Root 访问权限的 easy_install 的一些困惑
【发布时间】:2014-07-14 11:36:05
【问题描述】:

前言

我对 ssh/unix 协议非常陌生,希望我不会冒犯任何人。

上下文

我在我的大学使用内核,但没有 root 访问权限。因此,当我安装 python 模块时,我求助于这两个相关的堆栈溢出帖子的答案:

1) How to install python modules without root access?
2)How to install python packages without root privileges?

在第二篇文章中,Col Panic 强烈建议在核心上添加 pipeasy_install,如果它们还没有,'你应该礼貌地要求管理员添加它,向他们解释好处(他们不会再被单个包裹的请求所困扰)。”

根据那条建议,我请求管理员将easy_install 放在所有内核上。他们做到了,并且在使用 exportPATHPYTHONPATH 进行了一些众所周知的操作之后,我能够在内核上获得 numpyscipy 并将它们导入 iPython 环境。

不幸的是,matplotlib 出现了一些与这个问题相关的问题:ImportError: No module named backend_tkagg

我想我可以通过pickling 忽略这个与 SUSE 相关的问题,然后在我的笔记本电脑上绘制它。

我的问题

我真的需要 NetworkX。我写了一些关于我上次安装其他软件包时使用的所有小复杂性的笔记,但这次失败了。也许我忘记了我上次做的事情?

nemo01.65$ easy_install --prefix=/u/walnut/h1/grad/cmarshak/xdrive/xpylocal networkx
TEST FAILED: /u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python3.3/site-packages does
NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

  /u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python3.3/site-packages

and your PYTHONPATH environment variable currently contains:

  '/u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python2.7/site-packages'

Here are some of your options for correcting the problem:

  * You can choose a different installation directory, i.e., one that is
    on PYTHONPATH or supports .pth files

  * You can add the installation directory to the PYTHONPATH environment
    variable.  (It must then also be on PYTHONPATH whenever you run
    Python and want to use the package(s) you are installing.)

  * You can set up the installation directory to support ".pth" files by
    using one of the approaches described here:

    https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.

我尝试解决这个问题

我真的会做networkx,否则我必须调整一堆我想放在集群上的代码。

1) 我输入了:

export PYTHONPATH=/u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python3.3/site-packages

进入 bash 环境。运气不好...

2) 我向另一位毕业生寻求帮助。他建议我通过easy_install 安装pip,我这样做了然后使用:

pip install --user networkx

当我输入时:

find ./local/lib/python2.7/site-packages/ | grep net

我得到了大量来自 networkx 库的文件。不幸的是,依赖关系仍然存在一些问题。

提前感谢您的帮助。真的很喜欢从您的答案中学习新事物。

【问题讨论】:

    标签: python-2.7 ssh root networkx


    【解决方案1】:

    看起来有多个版本的 pip 浮动(参见 pip: dealing with multiple Python versions? )。尝试使用特定版本的easy_install 安装 pip。例如,这给了我一个pip2.7

    walnut.39$ easy_install-2.7 -U --user pip
    Searching for pip
    Reading https://pypi.python.org/simple/pip/
    Best match: pip 1.5.6
    Processing pip-1.5.6-py2.7.egg
    pip 1.5.6 is already the active version in easy-install.pth
    Installing pip script to /u/walnut/h1/grad/rcompton/.local/bin
    Installing pip2.7 script to /u/walnut/h1/grad/rcompton/.local/bin
    Installing pip2 script to /u/walnut/h1/grad/rcompton/.local/bin
    
    Using /net/walnut/h1/grad/rcompton/.local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
    Processing dependencies for pip
    Finished processing dependencies for pip
    walnut.40$ 
    

    然后使用pip2.7

    walnut.40$ pip2.7 install --user networkx
    

    另外,对于非 root 软件包安装,我的 .bashrc 中有以下几行:

    export PYTHONPATH=$PYTHONPATH:$HOME/.local/lib/python2.7/site-packages        
    export PATH=$PATH:~/.local/bin
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-07
      • 1970-01-01
      • 1970-01-01
      • 2014-11-02
      • 1970-01-01
      • 2016-09-15
      • 2017-11-08
      • 1970-01-01
      相关资源
      最近更新 更多