python - 使用虚拟 python 和 setuptool 安装 "Easy Install"

标签 python linux setuptools easy-install

我正在尝试在我没有 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.

最佳答案

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

的输出
echo $PYTHONPATH

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

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

关于python - 使用虚拟 python 和 setuptool 安装 "Easy Install",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9374485/

相关文章:

python - 通过循环通过 URL 传递参数

linux - 获取子进程的段错误回溯

python - 如何使用 setuptools 管理多个 python 子项目?

Python unittest __del__ 模块行为

python:如何在没有互联网连接的情况下创建 virtualenv

VS 2015 中的 Python IntelliSense/代码完成

c - gdb调试(带断点): Gtk-WARNING **: Invalid text buffer iterator

python - 基于真实时间、用户时间和系统时间比较两个不同的进程

python - 是否有 `setup.cfg` 的完整文档?

python - 如何使用光流估计量化帧之间的差异?