关于没有Root Access的easy_install的一些困惑

时间:2014-05-25 16:30:28

标签: python-2.7 ssh root networkx

前言

我是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)我向另一位毕业生寻求帮助。他建议我通过pip安装easy_install,我这样做然后使用:

pip install --user networkx

当我输入时:

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

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

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

1 个答案:

答案 0 :(得分:1)

看起来有多个版本的pip浮动(cf 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