How to transfer Anaconda env installed on one machine to another? [Both with Ubuntu installed]

前端 未结 4 1196
青春惊慌失措
青春惊慌失措 2021-02-05 18:52

I have been using Anaconda(4.3.23) on my GuestOS ubuntu 14.04 which is installed on Vmware on HostOS windows 8.1. I have setup an environm

4条回答
  •  青春惊慌失措
    2021-02-05 19:31

    ## You can try below approach to move all the package from one machine to other :
    ## Note : Machine that packages are being moved should be same and python version also should be same
    
    
    
    $ pip install conda-pack
    
    
    
    # To package an environment:
    
    ## Pack environment my_env into my_env.tar.gz
    
    $ conda pack -n my_env
    
    ## Pack environment my_env into out_name.tar.gz
    
    $ conda pack -n my_env -o out_name.tar.gz
    
    
    ## Pack environment located at an explicit path into my_env.tar.gz
    
    $ conda pack -p /explicit/path/to/my_env
    
    
    # After following above approach, you will end up with a tar.gz file. Now to install package from this zip file follow below approach.
    
    ## To install the environment:
    
    ## Unpack environment into directory `my_env`
    
    $ mkdir -p my_env
    $ tar -xzf my_env.tar.gz -C my_env
    
    
    ## Use Python without activating or fixing the prefixes. Most Python
    ## libraries will work fine, but things that require prefix cleanups
    ## will fail.
    
    $ ./my_env/bin/python
    
    
    ## Activate the environment. This adds `my_env/bin` to your path
    
    $ source my_env/bin/activate
    
    
    ## Run Python from in the environment
    
    (my_env) $ python
    
    
    ## Cleanup prefixes from in the active environment.
    ## Note that this command can also be run without activating the environment
    ## as long as some version of Python is already installed on the machine.
    
    (my_env) $ conda-unpack
    

提交回复
热议问题