Search code examples
pythonbashpipvirtualenvconda

Use zipped virtualenv


I'd like to create a virtual environment, zip it up, and execute code using the zipped virtual environment on another machine; it seems to be possible based on this article.

However, I'm having trouble and sourcing a virtualenv even locally using the technique described in the article.

$ conda create -y -n my_test python=3.5 numpy pandas
$ zip -r env.zip ~/anaconda3/envs/my_test
$ source env.zip/lib/python3.5/venv/scripts/common/activate
-bash: env.zip/lib/python3.5/venv/scripts/common/activate: Not a directory
$ tar cvfhz env.tgz ~/anaconda3/envs/my_test
$ source env.tgz/lib/python3.5/venv/scripts/common/activate
-bash: env.tgz/lib/python3.5/venv/scripts/common/activate: Not a directory

I've tried this on Mac OS X 10.13.6 and Ubuntu 16.04.


Solution

  • conda create --copy -y -n my_test python=3.5 numpy pandas