安装CygWin
安装cygwin的时候,顺便安装下面这些tool:
tree, vim, wget, curl, tmux, lynx, aria2
配置proxychains
Windows环境的proxychains,下载并按照下面方式放置在合适的位置。
把proxychains*.exe、 [cyg/msys-]proxychains_hook*.dll 复制到 PATH 环境变量包含的某个目录下。也可以把主程序(如 proxychains_win32_x64.exe)改为自己喜欢的名字,如 proxychains.exe。
配置文件可以放在下面的位置:
- 环境变量 $PROXYCHAINS_CONF_FILE 或通过 -f 命令行参数指定的文件
- $HOME/.proxychains/proxychains.conf(Cygwin 用户主目录)
- (SYSCONFDIR)/proxychains.conf
- /etc/proxychains.conf
安装apt-cyg
下面的apt-cyg直连可能是没法访问的,需要翻墙,谈到翻墙,在cygwin环境中还需要配置proxychains,可以参看上面的配置(需要有一个外网的代理)。
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
安装zsh
# 安装zsh
apt-cyg install zsh
# 配置oh-my-zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
# 修改cygwin的启动参数
C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico /bin/zsh --login
也可以使用下载install.sh的方式安装,如下:
# 下载install.sh
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
# 修改install.sh
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
# 改为:
REPO=${REPO:-mirrors/oh-my-zsh}
REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}
# 修改remote url
cd ~/.oh-my-zsh
git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
git pull
有时需要更新omz,可以使用手工更新的方式,如下:
omz update
安装
安装top工具
apt-cyg install procps
配置vim
编辑.vimrc
set guifont=Lucida_Console:h10
set expandtab
set tabstop=4
set shiftwidth=4
set nobackup
set nu!
set nocompatible
配置tmux
alias xn="tmux new -s"
alias xa="tmux attach -t"
alias xl="tmux ls"
配置conda
如果想在cygwin环境下,使用conda环境,需要在.bashrc下增加如下内容:
###############################################################################
# Anaconda Environment Selection - Plese set CONDA_BASE_DIR to the directory
# containing the base installation of anaconda/miniconda.
export CONDA_BASE_DIR=/cygdrive/c/Users/dupei/miniconda3
# Proxy Servers & Network Setup (if needed)
export HTTP_PROXY=
export HTTPS_PROXY=
# IMPORTANT - Ignore carriage returns when using a Cygwin environment.
if [[ "${OSTYPE}" == 'cygwin' ]]; then
export SHELLOPTS
set -o igncr
fi
###############################################################################
# Manage conda environments for Python. We check the environment variable
# $CONDA_DEFAULT_ENV to see which environment is desired. The default (root)
# environment will be chosen if nothing is specified. Note that this variable
# will be explicitly managed by the cyg-activate ( ) function we have defined
# below, specifically for the purpose of changing environments. The root
# environment is also handled slightly different from the others when it comes
# to setting the CONDA_DEFAULT_ENV variable.
if [ ${CONDA_DEFAULT_ENV} ] && [ ${CONDA_DEFAULT_ENV} != 'root' ]
then
# SELECT ONE OF THE NON-DEFAULT ENVIRONMENTS
export CONDA_PREFIX=${CONDA_BASE_DIR}/envs/${CONDA_DEFAULT_ENV}
else
# SELECT THE DEFAULT ENVIRONMENT (and set CONDA_DEFAULT_ENV full path)
export CONDA_DEFAULT_ENV=root
export CONDA_PREFIX=${CONDA_BASE_DIR}
fi
###############################################################################
# Define cyg-conda and cyg-activate to facilitate management of conda.
alias cyg-conda=${CONDA_BASE_DIR}/Scripts/conda.exe
cyg-activate() {
export CONDA_DEFAULT_ENV=$1
source ~/.bash_profile
cyg-conda info --envs
}
###############################################################################
# PATH - ALl of the anaconda/miniconda path entries appear first.
PATH=
PATH=$PATH:$CONDA_PREFIX
PATH=$PATH:$CONDA_PREFIX/Library/mingw-w64/bin
PATH=$PATH:$CONDA_PREFIX/Library/usr/bin
PATH=$PATH:$CONDA_PREFIX/Library/bin
PATH=$PATH:$CONDA_PREFIX/Scripts
PATH=$PATH:$HOME/scripts
PATH=$PATH:$HOME/local/bin
PATH=$PATH:/usr/local/bin
PATH=$PATH:/usr/bin
export PATH
###############################################################################
使用时,可以使用如下命令启动指定的环境,第一次需要使用
source activate env-name
后面可以使用conda activate env-name
本文详细介绍了CygWin的安装过程,包括安装必要的工具如tree、vim、wget等,并且讲解了如何配置proxychains、apt-cyg、zsh以及tmux。此外,还涵盖了conda环境的配置,确保在CygWin中能够顺利使用conda管理软件包。

6681

被折叠的 条评论
为什么被折叠?



