软件安装
下载地址
Python官网安装地址 : https://www.python.org/downloads
以安装Python 3.7.4为例
安装包选项
安装包选项如下:
Version | Operating System | Description | File Size | GPG |
---|---|---|---|---|
Gzipped source tarball | Source release | 23017663 | SIG | |
XZ compressed source tarball | Source release | 17131432 | SIG | |
macOS 64-bit/32-bit installer | Mac OS X | for Mac OS X 10.6 and later | 34898416 | SIG |
macOS 64-bit installer | Mac OS X | for OS X 10.9 and later | 28082845 | SIG |
Windows help file | Windows | 8131761 | SIG | |
Windows x86-64 embeddable zip file | Windows | for AMD64/EM64T/x64 | 7504391 | SIG |
Windows x86-64 executable installer | Windows | for AMD64/EM64T/x64 | 26680368 | SIG |
Windows x86-64 web-based installer | Windows | for AMD64/EM64T/x64 | 1362904 | SIG |
Windows x86 embeddable zip file | Windows | 6741626 | SIG | |
Windows x86 executable installer | Windows | 25663848 | SIG | |
Windows x86 web-based installer | Windows | 1324608 | SIG |
参数说明
web-based installer 是需要通过联网完成安装的
executable installer 是可执行文件(*.exe)方式安装
embeddable zip file 嵌入式版本,可以集成到其它应用中。
embeddable zip file 嵌入式版本官网描述如下:
The embedded distribution is a ZIP file containing a minimal Python environment. It is intended for acting as part of another application, rather than being directly accessed by end-users.
When extracted, the embedded distribution is (almost) fully isolated from the user’s system, including environment variables, system registry settings, and installed packages. The standard library is included as pre-compiled and optimized .pyc files in a ZIP, and python3.dll, python35.dll, python.exe and pythonw.exe are all provided. Tcl/tk (including all dependants, such as Idle), pip and the Python documentation are not included.
Note:The embedded distribution does not include the Microsoft C Runtime and it is the responsibility of the application installer to provide this. The runtime may have already been installed on a user’s system previously or automatically via Windows Update, and can be detected by finding ucrtbase.dll in the system directory.
Third-party packages should be installed by the application installer alongside the embedded distribution. Using pip to manage dependencies as for a regular Python installation is not supported with this distribution, though with some care it may be possible to include and use pip for automatic updates. In general, third-party packages should be treated as part of the application (“vendoring”) so that the developer can ensure compatibility with newer versions before providing updates to users.
The two recommended use cases for this distribution are described below.
安装步骤
选择安装Windows x86-64 executable installer版本
安装
1.双击python-3.7.4-amd64.exe
首页界面
点击自定义安装
说明:
Python launcher根据文件头自动帮我们调用了指定版本的解释器来执行该文件。
勾选相应需求,点击下一步
点击安装
注意:如果是第一次安装,安装完成后会有个提示 Removing the MAX_PATH Limitation。我们选择Enable即可。主要原因是 Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.也可以手动修改注册表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem@LongPathsEnabled to 1.
检测安装
Win+r
==> cmd
调出命令行窗口
输入python --version
输入pip --version
安装目录介绍
下面简单介绍一下目录、文件的具体用途:
DLLs: Python 自己使用的动态库
Doc: 自带的 Python 使用说明文档
include: 包含共享目录
Lib: 库文件,放自定义模块和包
libs: 编译生成的Python 自己使用的静态库
Scripts: 各种包/模块对应的可执行程序。安装时如果选择了pip。那么pip的可执行程序就在此!
tcl: 桌面编程包
参考文献
原文:https://blog.csdn.net/ZCShouCSDN/article/details/84990674
嵌入式python安装
1.选择安装Windows x86-64 embeddable zip file版本
2.安装pip
下载get-pip.py到解压后的目录中:
3.之后运行:.\python get-pip.py
修改python37._pth
:
python37.zip
.
# Uncomment to run site.main() automatically
import site # 去掉注释
4.安装第三方库
命令行切换到当前pythonan安装目录
执行命令:
.\python -m pip install 库名
5.python程序执行
.\python C:\Users\DELL\Downloads\Compressed\python-3.7.4
-embed-amd64\coding\my.py
Python常用命令行
1.运行python 程序
.\python python文件名带后缀名
例子:.\python my.py
2.安装第三方库或者包
.\python -m pip install 库名
例子:.\python -m pip install qrcode
疑问
安装目录的各个数据分别是哪里来的?
在Lib/site-packages
设置环境变量的作用
pip安装的模块安装在哪个目录,如何自定义安装目录?
Scripts目录里的可执行文件是如何产生的?