python 2.7 环境配置

原文地址:Python 2.7的安装(64位win10)

Python 2.7.12

下载地址:https://www.python.org/downloads/

安装路径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来进行安装。

安装方法为解压缩下载的安装包,进入setuptools目录,打开cmd,运行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路径也加入到环境变量中。

(注:setuptools 安装完后,下图中是没有后三项的, pip相关内容是pip安装后才出现的)

pip

下载最新版pip,使用python setup.py install指令安装。

pip 8.1.2

下载地址:https://pypi.python.org/pypi/pip#downloads

解压缩文件夹,找到setup.py ,进入cmd,使用python setup.py install指令安装。

 

可以不安装,输入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用法如下:

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 --显示帮助信息

posted @ 2019-07-24 10:43  mumu122  阅读(2790)  评论(0编辑  收藏  举报