python-免安装

注意 win7 需要 Windows6.1-KB2533623-x64.msu 补丁

查看当前路径

# python 环境下
import sys
sys.path

WinPython

github

pyd 文件搜索路径
set PYTHONPATH = 路径

path 里面添加 dll 路径
tkArcTool\Library\bin

官网下载 python-3.8.3-embed-amd64 版本

注意系统需要先确认一下 3.8.3 安装版能否正常安装,我虚拟机的win7版本过于老旧,缺少补丁包,导致socket dll 加载总是失败。问题找了好久。
我装的 windows 版本 提示缺少 KB2533623 补丁包

修改 python38.pth 内容

添加搜索路径,去掉 import site 前面的注释

python38.zip
.
.\Lib
.\Lib\site-packages
.\DLLs

# Uncomment to run site.main() automatically
import site

进入目录里面,执行 python,进入终端,以下操作都在该终端内执行

安装 pip

pip site
下载 get-pip.py 网页另存为比较快

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py --no-setuptools --no-wheel

get-pip.py options
--no-setuptools
If set, do not attempt to install setuptools

--no-wheel
If set, do not attempt to install wheel

安装其他需要的包

Scripts\pip install pandas  -i https://pypi.tuna.tsinghua.edu.cn/simple 
Scripts\pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple

然后拷贝到目标机就可以使用了。

移除 pip

python -m pip uninstall pip setuptools wheel

添加 tkinter

从虚拟环境中复制下面文件夹和文件

tcl
Lib/tkinter
DLLs/_tkinter.pyd, tcl86t.dll, tk86t.dll

主要问题就是设置搜索路径,让 python 找到库和 dll

set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;./Library/bin;./Dlls;./tcl;./Scripts;./libs;./Lib;

ModuleNotFoundError: No module named ‘Tkinter’

tcl folder to embedded_distribution_folder\ (root folder of the embedded distribution)
tkinter folder (which is under Lib) either to embedded_distribution_folder\Lib or to embedded_distribution_folder\
files _tkinter.pyd tcl86t.dll tk86t.dll (which are under DLLs) either to embedded_distribution_folder\DLLs or to embedded_distribution_folder\