首頁 > 軟體

Cygwin設定指南

2020-06-16 16:39:04

Cygwin設定總結

Cygwin是

  • 大量GNU和開放原始碼工具的集合,它們提供了類似於Windows上的Linux發行版的功能。

  • DLL(cygwin1.dll),它提供了大量的POSIX API功能。

Cygwin不是

  • 一種在Windows上執行本地Linux應用程式的方法。如果希望應用程式在Windows上執行,則必須從原始碼重新構建應用程式。

  • 一種神奇地使本機Windows應用程式知道UNIX∈功能(如信號、ptys等)的方法。同樣,如果想利用Cygwin功能,需要從原始碼構建應用程式。

安裝Cygwin

  • 通過執行setup-x86_64.exe(64位元安裝)或setup-x86.exe(32位元安裝)安裝Cygwin

  • 使用安裝程式執行新安裝或更新現有安裝。

  • 請記住,發行版中的單個包是與DLL分開更新的,所以Cygwin DLL版本對於一般的Cygwin發行版本號來說沒有用。

國內源地址

  • 網易 http://mirrors.163.com/cygwin/

  • 中科大 http://mirrors.ustc.edu.cn/cygwin/
  • 搜狐 http://mirrors.sohu.com/cygwin/

安裝過程中選擇站點時一定要自己新增國內源,不然下載會很慢,推薦搜狐

安裝第三方包管理工具apt-cyg

wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
mv apt-cyg /bin/apt-cyg
chmod +x /bin/apt-cyg
apt-cyg mirror http://mirrors.sohu.com/cygwin/

apt-cyg用法

install
  Install package(s).

remove
  Remove package(s) from the system.

update
  Download a fresh copy of the master package list (setup.ini) from the
  server defined in setup.rc.

download
  Retrieve package(s) from the server, but do not install/upgrade anything.

show
  Display information on given package(s).

depends
  Produce a dependency tree for a package.

rdepends
  Produce a tree of packages that depend on the named package.

list
  Search each locally-installed package for names that match regexp. If no
  package names are provided in the command line, all installed packages will
  be queried.

listall
  This will search each package in the master package list (setup.ini) for
  names that match regexp.

category
  Display all packages that are members of a named category.

listfiles
  List all files owned by a given package. Multiple packages can be specified
  on the command line.

search
  Search for downloaded packages that own the specified file(s). The path can
  be relative or absolute, and one or more files can be specified.

searchall
  Search cygwin.com to retrieve file information about packages. The provided
  target is considered to be a filename and searchall will return the
  package(s) which contain this file.

安裝編譯環境

apt-cyg install gcc-core gcc-g++ gdb make autoconf automake libboost-devel

安裝系統管理工具

apt-cyg install openssh openssl binutils util-linux bash-completion procps inetutils bind-utils

安裝常用工具

apt-cyg install git wget curl vim tree

安裝Python

apt-cyg install python python-ipython python-pip python-setuptools
apt-cyg install python3 python3-ipython python3-pip python3-setuptools

#pip設定
mkdir ~/.pip
touch ~/.pip/pip.conf
echo -e "[global]nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > ~/.pip/pip.conf
python -m pip install --upgrade pip
pip install ipython

#語法檢查
pip install --user flake8
#自動程式碼提示
pip install --user jedi
#自動匯入模組
pip install --user isort
#程式碼格式化
pip install --user yapf

安裝幫助手冊

apt-cyg install help2man man-db man-pages-posix

安裝zsh

apt-cyg install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

安裝nodejs

npm config set registry https://registry.npm.taobao.org
npm i -g tldr
tldr --update
npm i -g cnpm --registry=https://registry.npm.taobao.org
npm i -g yarn
yarn config set registry https://registry.npm.taobao.org

Cygwin 3.0.0-1 發布,POSIX相容環境  https://www.linuxidc.com/Linux/2019-02/156957.htm

Windows下Cygwin安裝使用教學  https://www.linuxidc.com/Linux/2019-02/156968.htm


IT145.com E-mail:sddin#qq.com