【问题标题】:Install "Easy Install" using virtual python and setuptool使用虚拟 python 和 setuptool 安装“Easy Install”
【发布时间】:2012-03-11 13:58:01
【问题描述】:

我正在尝试在我没有 root 访问权限的 linux 服务器上安装 virtual-python。我已经阅读了自定义安装的 PEAK 开发手册,但是我仍然无法弄清楚我做错了什么。

这是我的配置:

创建 .pythdisutils.cfg

 [install]
 install_lib  = /home2/me/lib
 install_scripts = /home2/me/bin

.bashrc 中的 Python 环境路径:

 export  PYTHONPATH="${PYTHONPATH}:~/lib/"

虚拟python安装在:

 ~/lib/python2.4/site-packages
 ~/bin/python

我尝试了这些代码但没有成功:

 sh setuptools-0.6c11-py2.4.egg
 sh setuptools-0.6c11-py2.4.egg --prefix=~
 ...

我得到的错误:

 TEST FAILED: /home2/me/lib/ 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:

/home2/me/lib/

and your PYTHONPATH environment variable currently contains:

':~/lib/python2.4/site-packages/:~/lib/python2.4/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:

http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations

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

【问题讨论】:

    标签: python linux setuptools easy-install


    【解决方案1】:

    您的PYTHONPATH 似乎设置不正确。试试“exec bash”,验证输出

    echo $PYTHONPATH
    

    包含预期值。将~ 替换为$HOME

    哦,您实际上是在使用bash 作为外壳吗?除非你重新启动你的 shell 并且你正在使用 bash,否则修改 .bashrc 当然不会改变任何东西。

    【讨论】:

    • 好吧,我听从了你的建议,我得到了这个::~/lib/python2.4/site-packages/:~/lib/python2.4/site-packages/:~/lib/: ~/lib/:~/lib/:/home2/me:/home2/me 在输入 echo 后。我不知道为什么,但 bashrc 没有看到这个奇怪的代码。我确实更新了 baschrc
    • 不要只放$HOMÈ,你需要$HOME/lib。它有效吗?
    • 哦,不,我把这个 PYTHONPATH="${PYTHONPATH}:$HOME/lib/" 我得到了上面的行:(
    • 那您还没有执行它...您知道.bashrc 不会自动重新读取
    • 我做了 source .bashrc 然后 exec bash 如你所说。我错过了什么吗?
    【解决方案2】:
    export PYTHONPATH="${PYTH/home2/me/lib"
    

    这似乎……不是错字就是错误。也许你的意思是......

    export PYTHONPATH="$PYTHONPATH:/home2/me/lib"
    

    ?

    【讨论】:

      猜你喜欢
      • 2014-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-03
      • 2016-07-04
      • 2018-02-20
      • 2016-06-16
      • 1970-01-01
      相关资源
      最近更新 更多