组保留的标签 余下为需要删除的标签
unset($oldtag[$key]);
}
}
}
if (!empty($oldtag)) {
$tagids = array();
foreach ($oldtag as $tagid => $tagname) {
$tagids[] = $tagid;
}
well_oldtag_delete($tagids, $tid);
}
$r = well_tag_process($tid, $fid, $create_tag, $tagarr);
return $r;
}
// 删除标签和绑定的主题
function well_oldtag_delete($tagids, $tid)
{
$pagesize = count($tagids);
$arrlist = well_tag_find_by_tagids($tagids, 1, $pagesize);
$delete_tagids = array(); // 删除
$tagids = array();
$n = 0;
foreach ($arrlist as $val) {
++$n;
if (1 == $val['count']) {
// 只有一个主题
$delete_tagids[] = $val['tagid'];
} else {
$tagids[] = $val['tagid'];
}
}
!empty($delete_tagids) and well_tag_delete($delete_tagids);
$arlist = well_tag_thread_find_by_tid($tid, 1, $n);
if ($arlist) {
$ids = array();
foreach ($arlist as $val) $ids[] = $val['id'];
well_tag_thread_delete($ids);
}
!empty($tagids) and well_tag_update($tagids, array('count-' => 1));
}
// 标签数据处理 $arr=新提交的数组 $tagarr=保留的旧标签
function well_tag_process($tid, $fid, $new_tags = array(), $tagarr = array())
{
if (empty($tid)) return '';
// 新标签处理入库
if ($new_tags) {
$threadarr = array();
$tagids = array();
$i = 0;
$size = 5;
$n = count($tagarr);
$n = $n > $size ? $size : $size - $n;
foreach ($new_tags as $name) {
++$i;
$name = trim($name);
$name = stripslashes($name);
$name = strip_tags($name);
$name = str_replace(array(' ', '#', "@", "$", "%", "^", '&', '·', '<', '>', ';', '`', '~', '!', '¥', '……', ';', '?', '?', '-', '—', '_', '=', '+', '.', '{', '}', '|', ':', ':', '、', '/', '。', '[', ']', '【', '】', '‘', ' ', ' ', ' ', ' ', ' '), '', $name);
$name = htmlspecialchars($name, ENT_QUOTES);
if ($name && $i <= $n) {
// 查询标签
$read = well_tag_read_name($name);
if ($read) {
// 存在 count+1
$tagids[] = $read['tagid'];
} else {
// 入库
$arr = array('name' => $name, 'count' => 1);
$tagid = well_tag_create($arr);
FALSE === $tagid and message(-1, lang('create_failed'));
$read = array('tagid' => $tagid, 'name' => $name);
}
$tag_thread = array('tagid' => $read['tagid'], 'tid' => $tid);
$threadarr[] = $tag_thread;
$tagarr[$read['tagid']] = $read['name'];
}
}
!empty($threadarr) and tag_thread_big_insert($threadarr);
!empty($tagids) and well_tag_update($tagids, array('count+' => 1));
}
$json = empty($tagarr) ? '' : xn_json_encode($tagarr);
return $json;
}
?>
如何在Windows上安装Python 3.12-阿南达文事网
如何在Windows上安装Python 3.12
编程日记10
更新时间:2025-05-26 09:20:12 如何在Windows上安装Python 3.12
Windows 安装 python 3.12 的方法。
下面的内容是针对这个安装方法使用 AI 的回复对比。
2025-03-21_08-43-42如果不让安装程序设置环境变量的话,可能会得到下面的路径配置错误:
2025-03-21_12-39-15如果默认的时候没有配置环境变量,可以重新运行安装程序再次安装然后把环境变量添加进来。
2025-03-21_12-49-34随后再次检查运行版本。
2025-03-21_12-54-25如没有问题,则说明已添加到环境变量中。
在 Windows 系统上安装 Python 3.12 相对简单,以下是几种常用方法:
方法一:使用官方安装程序
- 访问 Python 官网下载页面:Download Python | Python
- 点击下载 Python 3.12 的 Windows 安装程序
- 运行下载的安装文件(例如 python-3.12.0-amd64.exe)
- 在安装界面勾选 “Add Python 3.12 to PATH”(重要,这样可以在命令行中直接使用 python 命令)
- 选择 “Install Now” 进行默认安装,或选择 “Customize installation” 自定义安装选项
- 等待安装完成
方法二:使用 Microsoft Store
- 打开 Microsoft Store
- 搜索 “Python 3.12”
- 选择 Python 3.12 并点击"获取"或"安装"
- 等待下载和安装完成
方法三:使用 Chocolatey 包管理器
如果您已经安装了 Chocolatey,可以通过命令行安装:
代码语言:javascript
代码运行次数:0运行
复制
choco install python --version=3.12
方法四:使用 Anaconda 或 Miniconda
- 下载并安装 Anaconda 或 Miniconda
- 使用 conda 创建 Python 3.12 环境:
conda create -n py312 python=3.12 conda activate py312
验证安装
安装完成后,打开命令提示符或 PowerShell,输入以下命令验证安装:
代码语言:javascript
代码运行次数:0运行
复制
python --version
应显示 Python 3.12.x 版本号。
注意事项
- 安装时建议勾选"Add Python to PATH"选项,以便在命令行中直接使用 python 命令
- 如果您需要多个 Python 版本共存,可以考虑使用 Anaconda/Miniconda 或 pyenv-win
- 如遇到权限问题,请尝试以管理员身份运行安装程序
希望这些安装方法对您有所帮助!
本文发布于:2025-05-26,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在Windows上安装Python 312
发布评论