如何在Windows上的python 2.7 virtualenv上安装python-ldap而不进行编译 [英] How to install python-ldap on a python 2.7 virtualenv on windows without compiling

查看:118
本文介绍了如何在Windows上的python 2.7 virtualenv上安装python-ldap而不进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Windows用作主要的python 2.7开发环境,并且希望在虚拟环境中安装python-ldap.

I am using Windows as my main python 2.7 development environment and I want to install python-ldap on a virtual environment.

python-ldap软件包需要编译:(当然,我不能在我的环境中对其进行编译.因此,我尝试查找二进制文件,以便通过easy_install将它们安装在我的虚拟环境中(仅供参考,您可以执行easy_install package.exe我将在此处找到分布式二进制文件: https://pypi. python.org/pypi/python-ldap/

The python-ldap package needs compiling :( and of course I can't compile it in my environment. So I tried finding binaries in order to install them in my virtual environment through easy_install (FYI you can do easy_install package.exe and the package will be installed). I found the distributed binaries here: https://pypi.python.org/pypi/python-ldap/

不幸的是,他们只为python 2.7提供.msi包!人们为什么使用.msi?无法通过easy_install安装MSI.我讨厌MSI%$#$ ^#$ ^#$

Unfortunately, they give only .msi packages for python 2.7 !!! Why do people use .msi ? MSI CANNOT BE INSTALLED THROUGH easy_install. I HATE MSI %$#$^#$^#$

是的,我可以通过执行.msi软件包来安装它,但是它将安装在全局python软件包中,而不会安装在我的虚拟环境中!

Yes I can install the .msi package by executing it but it will be installed in the global python packages and not on my virtual environment!

请,有人可以帮助我吗?我记得在先前的项目中遇到过这个确切的问题,我不得不在虚拟环境之外进行开发-但我现在无法做到这一点:(

Please, can anybody help me ? I remember having this exact problem in a previous project and I had to develop it outside of a virtual environment -- but I cannot do this now :(

更新:我在系统范围内安装了python-ldap并复制了目录 从PYTHON_GLOBAL \ Lib \ site-packages到VIRTUALENV \ Lib \ site-packages的ldap和python_ldap-2.4.10-py2.7.egg-info似乎正在运行.但是我真的不喜欢这种解决方案,所以我不会回答我的问题.另外,Alexander关于使用--system-site-packages重新创建我的virtualenv的评论可能会起作用,但这意味着我需要卸载很多全局软件包,然后再次安装我的虚拟软件包等,通常情况下,这不是干:(

Update: I installed python-ldap system-wide and copied the directories ldap and python_ldap-2.4.10-py2.7.egg-info from PYTHON_GLOBAL\Lib\site-packages to VIRTUALENV\Lib\site-packages and seems to be working now. However I really don't like that solution so I won't answer my question with that. Also, Alexander's comment on recreating my virtualenv with --system-site-packages probably will be working but this means that I'd need to uninstall a lot of my global packages packages and then install again my virtual packages etc and in general it's not DRY :(

更新2:在尝试了cgohlke的建议之后,我看到MSI的内容是我上面提到的两个目录,以及文件dsml.py,ldapurl.py和ldif.py.因此,我还将其复制到了我的VIRTUALENV \ Lib \ site-packages.现在我相信安装就可以了:).但是我相信cgohlke是最好的-只需使用msiexec.exe将msi的内容直接提取到您的VIRTUALENV.

Update 2: After trying cgohlke's suggestion, I saw that the contents of the MSI were the two directories I mentioned above along with the files dsml.py, ldapurl.py and ldif.py. So I also copied this to my VIRTUALENV\Lib\site-packages. Now I believe that the installation is ok :). But I believe that cgohlke's is the best one - just use msiexec.exe to extract the contents of the msi directly to your VIRTUALENV.

更新3:在类似的问题中( http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap .在其中,您将可以找到python-ldap和很多LOTS的.EXE安装包!!!因此,最后通过下载这些文件,您将可以在您的virtualenv中easy_install它们!

Update 3: In a similar question (Installing python-ldap in a virtualenv on Windows) I found a really interesting link: http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap. In there you will be able to find .EXE install packages for python-ldap and LOTS of others!!! So finally by downloading these you'll be able to easy_install them in your virtualenv!

推荐答案

如何在系统范围内安装它,如何从已安装的文件中创建一个鸡蛋,然后在您的虚拟环境中使用该鸡蛋?您可以在此处找到有关鸡蛋结构的一些信息: http://pythonhosted.org/setuptools/formats.html

How about installing it system-wide, creating an egg from installed files and then using that egg in your virtual env? You can find some info about egg structure here: http://pythonhosted.org/setuptools/formats.html

这篇关于如何在Windows上的python 2.7 virtualenv上安装python-ldap而不进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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