使用虚拟python和setuptool安装“Easy Install”

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

这是我的配置:

创建了.pythdisutils.cfg

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

.bashrc中的Python env路径:

 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.

解决方法:

您的PYTHONPATH似乎没有正确设置.尝试“exec bash”,并验证输出

echo $PYTHONPATH

包含预期值.用$HOME替换〜.

哦,你真的使用bash作为shell吗?除非你重新启动shell并使用bash,否则修改.bashrc当然不会改变任何东西.

上一篇:如何在Python包中安全地“伪造”模块


下一篇:在脚本的shebang行中添加Python参数(使用buildout和zc.recipe.egg:脚本创建的脚本)