如何使用distutils安装到特定的Python安装?

时间:2021-11-20 23:01:54

I have a Windows machine with Python 2.3, 2.6 and 3.0 installed and 2.5 installed with Cygwin. I've downloaded the pexpect package but when I run "python setup.py install" it installs to the 2.6 installation.

我有一台安装了Python 2.3,2.6和3.0的Windows机器,以及安装了Cygwin的2.5机器。我已经下载了pexpect包,但是当我运行“python setup.py install”时,它安装到2.6安装。

How could I have it install to the Cygwin Python installation, or any other installation?

我怎么能安装到Cygwin Python安装或任何其他安装?

2 个解决方案

#1


call the specific python version that you want to install for. For example:

调用要安装的特定python版本。例如:

$ python2.3 setup.py install

should install the package for python 2.3

应该安装python 2.3的包

#2


using "python2.3" can be wrong if another (default) installation patched PATH to itself only.

如果另一个(默认)安装仅将PATH修补为自身,则使用“python2.3”可能会出错。

Task can be solved by:

任务可以通过以下方式解决

  1. finding full path to desired python interpreter, on ActivePython it is C:\Python26 for default installation of Python 2.6
  2. 找到所需python解释器的完整路径,在ActivePython上,对于Python 2.6的默认安装,它是C:\ Python26

  3. make a full path to binary (in this case C:\Python26\python.exe)
  4. 制作二进制的完整路径(在本例中为C:\ Python26 \ python.exe)

  5. execute module install command from unpacked module directory using full path to interpreter: C:\Python26\python.exe setup.py install
  6. 使用解释器的完整路径从解包模块目录执行module install命令:C:\ Python26 \ python.exe setup.py install

#1


call the specific python version that you want to install for. For example:

调用要安装的特定python版本。例如:

$ python2.3 setup.py install

should install the package for python 2.3

应该安装python 2.3的包

#2


using "python2.3" can be wrong if another (default) installation patched PATH to itself only.

如果另一个(默认)安装仅将PATH修补为自身,则使用“python2.3”可能会出错。

Task can be solved by:

任务可以通过以下方式解决

  1. finding full path to desired python interpreter, on ActivePython it is C:\Python26 for default installation of Python 2.6
  2. 找到所需python解释器的完整路径,在ActivePython上,对于Python 2.6的默认安装,它是C:\ Python26

  3. make a full path to binary (in this case C:\Python26\python.exe)
  4. 制作二进制的完整路径(在本例中为C:\ Python26 \ python.exe)

  5. execute module install command from unpacked module directory using full path to interpreter: C:\Python26\python.exe setup.py install
  6. 使用解释器的完整路径从解包模块目录执行module install命令:C:\ Python26 \ python.exe setup.py install