简体   繁体   中英

Can I use same virtual environment on different computers

On my office computer, I've made virtualenv one-for-rule-them-all at the Dropbox folder. I want to use this environment both at work and at home. Is this possible? (currently I'm not successful)

Look into using the relocatable option of virtualenv. For full documentation, see the virtualenv documentation on the subject .

One note of interest:

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).

As an alternative to this approach, I would simply manage your project/setup dependencies with setup.py requirements ( install_requires , setup_requires ), or pip requirements.txt file. This is much more portable and cross-platform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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