I'm using Python 3.4 on Windows. I have created a virtual environment with
python c:\Python34\Tools\Scripts\pyvenv.py foo
Then activated it
foo\Scripts\activate.bat
And installed several libraries in it.
Question: Is it safe to rename the venv folder "foo" to "bar"? I.e. once i have renamed foo to bar, then activate it with
bar\Scripts\activate.bat
will it still work?
What could make problems are any environment variable settings and absolute paths.
To be able to do that you should use virtualenv
. From the docs:
Normally environments are tied to a specific path. That means that you cannot move an environment around or copy it to another computer. You can fix up an environment to make it relocatable with the command:
$ virtualenv --relocatable ENV
This will make some of the files created by setuptools or distribute use relative paths, and will change all the scripts to use activate_this.py instead of using the location of the Python interpreter to select the environment.
Note: you must run this after you've installed any packages into the environment. If you make an environment relocatable, then install a new package, you must run virtualenv --relocatable again.
But be aware:
The --relocatable option currently has a number of issues, and is not guaranteed to work in all circumstances. It is possible that the option will be deprecated in a future version of virtualenv.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With