美文网首页
conda操作-2 | 虚拟环境”更名“

conda操作-2 | 虚拟环境”更名“

作者: 切瓜少年 | 来源:发表于2020-09-13 16:50 被阅读0次

    1 背景

    唐老哥帮我安装了Stream包,然而虚拟环境命名为py-monocle(就是python环境下类似monocle包功能的包),担心过几天就忘了着什么东西,所以准备改个名。但是conda是不支持虚拟环境的重命名的,因此需要通过复制和删除原环境的方法更名。

    2 通过复制和删除操作“重命名”conda虚拟环境

    首先进行复制,报了一大堆error,不过没关系:

    conda create --name py-stream --clone py-monocle
    Source:      /mnt/d/Linux/software/anaconda/envs/py-monocle
    Destination: /mnt/d/Linux/software/anaconda/envs/py-stream
    Packages: 428
    Files: 1014
    
    Downloading and Extracting Packages
    tzlocal-2.1          | ######################################################################################### | 100%
    Preparing transaction: done
    Verifying transaction: -
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter/xt_DSCP.h'
    has an incorrect size.
      reported size: 634 bytes
      actual size: 638 bytes
    
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter/xt_RATEEST.h'
    has an incorrect size.
      reported size: 305 bytes
      actual size: 774 bytes
    
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter/xt_TCPMSS.h'
    has an incorrect size.
      reported size: 172 bytes
      actual size: 190 bytes
    
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter/xt_connmark.h'
    has an incorrect size.
      reported size: 542 bytes
      actual size: 646 bytes
    
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter/xt_mark.h'
    has an incorrect size.
      reported size: 149 bytes
      actual size: 157 bytes
    
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter_ipv4/ipt_TTL.h'
    has an incorrect size.
      reported size: 294 bytes
      actual size: 350 bytes
    
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h'
    has an incorrect size.
      reported size: 672 bytes
      actual size: 824 bytes
    
    SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/Linux/software/anaconda/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
    appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter_ipv6/ip6t_HL.h'
    has an incorrect size.
      reported size: 327 bytes
      actual size: 377 bytes
    
    SafetyError: The package for ncurses located at /mnt/d/Linux/software/anaconda/pkgs/ncurses-6.2-he1b5a44_1
    appears to be corrupted. The path 'share/terminfo/E/Eterm'
    has an incorrect size.
      reported size: 2224 bytes
      actual size: 842 bytes
    
    ClobberError: The package 'conda-forge/linux-64::ncurses-6.2-he1b5a44_1' cannot be installed due to a
    path collision for 'share/terminfo/E/Eterm'.
    This path already exists in the target prefix, and it won't be removed
    by an uninstall action in this transaction. The path is one that conda
    doesn't recognize. It may have been created by another package manager.
    
    
    ClobberError: The package 'conda-forge/linux-64::ncurses-6.2-he1b5a44_1' cannot be installed due to a
    path collision for 'share/terminfo/E/Eterm-color'.
    This path already exists in the target prefix, and it won't be removed
    by an uninstall action in this transaction. The path is one that conda
    doesn't recognize. It may have been created by another package manager.
    
    
    ClobberError: The package 'conda-forge/linux-64::ncurses-6.2-he1b5a44_1' cannot be installed due to a
    path collision for 'share/terminfo/L/LFT-PC850'.
    This path already exists in the target prefix, and it won't be removed
    by an uninstall action in this transaction. The path is one that conda
    doesn't recognize. It may have been created by another package manager.
    
    
    \
    done
    Executing transaction: done
    #
    # To activate this environment, use
    #
    #     $ conda activate py-stream
    #
    # To deactivate an active environment, use
    #
    #     $ conda deactivate
    

    激活新环境,测试其中的包是否能用:

    conda activate py-stream
    /mnt/d/tmp$ python
    Python 3.6.11 | packaged by conda-forge | (default, Aug  5 2020, 20:09:42)
    [GCC 7.5.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import stream
    /mnt/d/Linux/software/anaconda/envs/py-stream/lib/python3.6/site-packages/rpy2/robjects/pandas2ri.py:17: FutureWarning:
    
    pandas.core.index is deprecated and will be removed in a future version.  The public classes are available in the top-level namespace.
    
    >>> quit()
    

    stream包是可以成功导入的。
    然后删除原来的环境:

    conda remove -n py-monocle --all
    

    ok了

    相关文章

      网友评论

          本文标题:conda操作-2 | 虚拟环境”更名“

          本文链接:https://www.haomeiwen.com/subject/etuyektx.html