将Python二进制模块安装到Windows中的自定义位置 [英] Installing Python binary modules to a custom location in Windows

查看:142
本文介绍了将Python二进制模块安装到Windows中的自定义位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想在Windows上为Python安装一个二进制模块.假设该模块作为使用distutils准备的预安装安装程序xxx-n.n.n.win32-py2.7.exe分发.

Suppose that I want to install a binary module for Python on Windows. Suppose that the module is distributed as a pre-built installer xxx-n.n.n.win32-py2.7.exe, prepared using distutils.

我的问题是安装程序坚持将软件包安装到他在注册表中找到的任何Python目录中.但是,我不时使用闪存驱动器上的这个便携式" Python目录,并且需要在其中安装软件包.该目录未在注册表中标记.

My problem is that the installer insists on installing the package into whatever Python directory he finds in the registry. However, I have this tiny "portable" Python directory on a flash drive that I use from time to time and need to have packages installed there. That directory is not marked in the registry.

到目前为止,我只是在打开安装程序的包装,然后将文件手动复制到Lib/site-packages中.但是,也许有一个更明智的选择?我可以以某种方式破解distutils安装程序,让我指定目标Python目录(就像其他一些安装程序一样)吗?

So far what I was doing was simply unpacking the installer and manually copying the files into Lib/site-packages. But perhaps there is a smarter alternative? Could I hack the distutils installer somehow to let me specify the target Python directory (as some other installers do)?

PS:请注意,简易安装不是一种选择,因为它坚持从源代码编译软件包,而我想安装预编译的软件包.

PS: Note that easy-install is not an option, as it insists on compiling packages from source, whereas I want to install the precompiled package.

推荐答案

可以使用easy_install安装二进制软件包,并且不需要编译:

You can install binary packages using easy_install and it doesn't require compilation:

easy_install binary_installer_built_with_distutils.exe

请参见我可以将Python Windows软件包安装到virtualenvs吗?

这篇关于将Python二进制模块安装到Windows中的自定义位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆