简体   繁体   English

将预编译的软件包安装到python3 virtualenv中

[英]install precompiled packages into python3 virtualenv

I am working on an application in Python 3.3 on Win7 x64. 我正在使用Win7 x64上的Python 3.3中的应用程序。 When installing lxml with pip 使用pip安装lxml时

pip install lxml

i always get the following error: 我总是收到以下错误:

lxml error: Unable to find vcvarsall.bat

This question has been answered on SO before, but the solutions usually point to executables (as it occurs due to compiler problems). 之前在SO上已经回答了这个问题,但是解决方案通常指向可执行文件(由于编译器问题而出现)。 However, I want to install lxml into a virtualenv: 但是,我想将lxml安装到virtualenv中:

> cd \venv\Scripts
> activate
(venv) > pip install lxml

Obviously this get me the same vcvarsall.bat error as before; 显然,这使我获得了与以前相同的vcvarsall.bat错误; clearly I still don't have the right compiler installed. 显然,我仍然没有安装正确的编译器。

How do I install a precompiled executable ( like these ) into a virtualenv? 如何将预编译的可执行文件( 如这些 )安装到virtualenv中?

Thanks. 谢谢。

I have found a workaround, however I'm unsure whether this is a clean or even sane way of doing it. 我找到了一种解决方法,但是我不确定这是一种干净的甚至是理智的方法。

As the vcvarsall.bat error occurs due to a misconfigured or wrong compiler, use a precompiled package from the source in the question. 由于由于配置错误或错误的编译器而发生vcvarsall.bat错误,请使用问题中来源的预编译软件包。 If you install that package into the system python installation, it will put the scripts into 如果您将该软件包安装到系统python安装中,它将把脚本放入

C:\Python33\Lib\site-packages

after installation, there should be two folders: lxml and lxml-3.2.3-py3.3.egg-info . 安装后,应该有两个文件夹: lxmllxml-3.2.3-py3.3.egg-info By copying both folders into the respective folder of the virtualenv , the package should be available there as well. 通过将两个文件夹都复制到virtualenv的相应文件夹中,该软件包也应该在那里可用。 For example if the virtualenv is in C:\\venv\\ , copy the folders to C:\\venv\\Lib\\site-packages\\ . 例如,如果virtualenv位于C:\\venv\\ ,则将文件夹复制到C:\\venv\\Lib\\site-packages\\

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM