Python 2.7.12 下載地址:https://www.python.org/downloads/release/python-2712/ 安裝路徑D:\Program Files\Python27 python環境安裝比較簡單,下載python語言環境中的windows版本的msi格式文件, ...
Python 2.7.12
下載地址:https://www.python.org/downloads/release/python-2712/
安裝路徑D:\Program Files\Python27
python環境安裝比較簡單,下載python語言環境中的windows版本的msi格式文件,下載後雙擊安裝即可。
在安裝時選擇添加路徑到系統中,則環境變數Path中已經自動添加python安裝的路徑D:\Program Files\Python27
運行cmd,在命令行中測試一下
如上圖中所示,通過python命令,之後輸出經典的Hello, world!,表示python語言環境已經安裝成功了。
使用IDLE可以進行python程式編譯了。
setuptools和pip的安裝:這個是可以實現後續相關組件的自動安裝,但是在windows下需要手動下載相關組件,並通過python 運行setup.py來進行安裝。
安裝方法為打開cmd,進入setuptools目錄,運行python setup.py install命令來安裝。
setuptools 28.6.1
setuptools是 Python Enterprise Application Kit(PEAK)的一個副項目,它是一組Python的 distutilsde工具的增強工具(適用於 Python 2.3.5 以上的版本,64 位平臺則適用於 Python 2.4 以上的版本),可以讓程式員更方便的創建和發佈 Python 包,特別是那些對其它包具有依賴性的狀況。
下載地址:https://pypi.python.org/pypi/setuptools
安裝方法為打開cmd,進入setuptools的解壓目錄D:\python64\setuptools-28.6.1,運行python setup.py install命令來安裝。
安裝完成後可以進入python的安裝目錄下查看Scripts目錄中是否有easy_install.exe,有則表示安裝成功了。然後將Scripts路徑也加入到環境變數中。
pip
可以不安裝,輸入pip指令輸出如下:
D:\python64\setuptools-28.6.1>pip
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.
但使用pip時會出現更新提示。
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
因此,使用python -m pip install --upgrade pip進行pip更新,或下載最新版pip,使用python setup.py install指令安裝。
pip 8.1.2
下載地址:https://pypi.python.org/pypi/pip#downloads
常見pip用法如下:
pip install numpy --安裝包numpy
pip uninstall numpy --卸載包numpy
pip show --files PackageName --查看已安裝包
pip list outdated --查看待更新包信息
pip install --upgrade numpy --升級包
pip install -U PackageName --升級包
pip search PackageName --搜索包
pip help --顯示幫助信息