Can I move a virtualenv?

后端 未结 7 1423
栀梦
栀梦 2020-11-29 20:30

This question is not a duplicate.

It pertains not just to renaming a virtual environment, but to actually moving it to a different directory, incl

相关标签:
7条回答
  • 2020-11-29 20:58

    YES, YOU CAN! (In windows)

    The workaround is easy, just move your virtual environment anywhere then edit activate.bat inside scripts\:

    1. Move to the virtual environment to the desired directory

    2. Right-click and edit activate.bat located at venv_folder\scripts.

    3. Change VIRTUAL_ENV variable from:

       set VIRTUAL_ENV=C:\old_directory\venv_name
      

      into

       set VIRTUAL_ENV=C:\new_directory\venv_name
      
    4. Save the edited batch file, and thats it!

    NOTE: My solution should work and save windows users setting up new virtual environments, I doubt this will work in other operating system since .bat is from MS-DOS

    0 讨论(0)
提交回复
热议问题