我可以在不同的计算机上使用相同的虚拟环境吗

Can I use same virtual environment on different computers

在我办公室的电脑上,我在 Dropbox 文件夹中创建了 virtualenv one-for-rule-them-all。我想在工作和家里都使用这个环境。这可能吗? (目前我没有成功)

考虑使用 virtualenv 的 relocatable 选项。有关完整文档,请参阅 virtualenv documentation on the subject.

一个感兴趣的笔记:

Also, this does not make your packages cross-platform. You can move the directory around, but it can only be used on other similar computers. Some known environmental differences that can cause incompatibilities: a different version of Python, when one platform uses UCS2 for its internal unicode representation and another uses UCS4 (a compile-time option), obvious platform changes like Windows vs. Linux, or Intel vs. ARM, and if you have libraries that bind to C libraries on the system, if those C libraries are located somewhere different (either different versions, or a different filesystem layout).

作为这种方法的替代方法,我会简单地管理您的 project/setup 依赖项 setup.py 要求(install_requiressetup_requires)或 pip requirements.txt 文件。这更加便携和跨平台。