Last active
          March 15, 2023 16:19 
        
      - 
      
- 
        Save zfhxi/79658216f17e3fc43b6bc6cbdcceb56e to your computer and use it in GitHub Desktop. 
    批量替换复制conda环境时bin文件默认解释器
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| BIN_PATH=$1/bin | |
| PYTHON_INTERPRETER="#!$(realpath $BIN_PATH/python)" | |
| for file in $BIN_PATH/* | |
| do | |
| if [[ $(file -b "$file") == *"Python script"* ]];then | |
| sed -i "1s|.*|$PYTHON_INTERPRETER|g" $file | |
| fi | |
| done | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
How to use it?
$ cd /xxx/miniconda3/envs $ ls demo_py38 $ ./modify_interpreter.sh demo_py38