我可以在不同的电脑上使用相同的虚拟环境吗?

2024-04-20 15:01:06 发布

您现在位置:Python中文网/ 问答频道 /正文

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


Tags: 文件夹for环境virtualenvallruleonedropbox
1条回答
网友
1楼 · 发布于 2024-04-20 15:01:06

考虑使用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).

作为这种方法的替代方法,我将简单地使用设置.py需求(install_requiressetup_requires)或pip要求.txt文件。这是更便携和跨平台。在

相关问题 更多 >