需要更改virtualenv的哪些部分来重新放置它? [英] What parts of a virtualenv need to be changed to relocate it?

查看:65
本文介绍了需要更改virtualenv的哪些部分来重新放置它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我有一个Python程序,其中包含大量的插件/软件包.我希望能够在virtualenv中分发程序,以便将软件包捆绑在一起.但是,该程序适用于Windows,Windows上不支持virtualenvs的可重定位"功能(并且仍处于试验阶段).

So, I've got a Python program with a ridiculous number of addons/packages. I'd like to be able to distribute the program in its virtualenv, so that the packages come bundled. However, the program is for Windows, and the "relocatable" feature of virtualenvs is unsupported on Windows (as well as still being experimental).

因此,我正在寻找编写脚本或只是编写指令以手动更改绝对路径名以重新定位virtualenv.

So, I'm looking at either writing a script, or just writing instructions to manually change absolute path names to relocate the virtualenv.

我的问题是,是否有人知道在virtualenv中要在哪里寻找绝对路径名.我对Python打包很陌生. activate.bat脚本包含绝对路径名,但是各个软件包的安装路径中是否都硬编码了绝对路径名?

My question is if anybody knows where all I'd have to look for absolute path names in the virtualenv. I'm pretty new to Python packaging. The activate.bat script contains absolute path names, but do individual packages have absolute pathnames hard-coded into their installations?

使环境可重定位 virtualenv不能简单地移动,但是不会列出包含绝对路径名的位置.

The section Making Environments Relocatable describes why a virtualenv can't be simply moved, but doesn't list the places that contain absolute path names.

推荐答案

与其尝试手动进行操作,不如使用

Rather than trying to do this manually, you'd be better off using the freeze option to pip to create a requirements file. You can now rebuild your entire virtualenv with a single command.

在旧版virtualenv上:

On old virtualenv:

pip freeze > stable-req.txt

关于新的:

pip install -r stable-req.txt

这篇关于需要更改virtualenv的哪些部分来重新放置它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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