问题描述
因此,我有一个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.
推荐答案
与其尝试手动进行操作,不如使用选项创建一个需求文件.现在,您可以使用一个命令来重建整个virtualenv.
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的哪些部分来重新放置它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!