宝塔用户_jixoin 发表于 2025-10-24 01:06:23

【已解答】python安装失败,已经是最新版本

为了能快速了解并处理您的问题,请提供以下基础信息:面板、插件版本:
Linux正式版11.1.0
系统版本:CentOS 7.6
问题描述:python下载失败,提示网络连接错误,但网络无问题,而且为啥3.13没了……在安装记录里,显示成功,但所有错误都是一样的
相关截图(日志、错误):未找到本地记录文件,将向云端请求Python版本数据,这可能需要一段时间,请稍等正在检查网络状况......
解析错误
正在检查网络状况......
Traceback (most recent call last):
File "/www/server/panel/class/projectModel/btpyvm.py", line 528, in _get_versions_by_cloud
    stable_go_versions = self.__parser_xml(data_txt)
File "/www/server/panel/class/projectModel/btpyvm.py", line 565, in __parser_xml
    root = cElementTree.fromstring(data_txt)
File "/www/server/panel/pyenv/lib/python3.7/xml/etree/ElementTree.py", line 1315, in XML
    parser.feed(text)
File "<string>", line None
xml.etree.ElementTree.ParseError: mismatched tag: line 7, column 2
未找到对应版本
Traceback (most recent call last):
File "/www/server/panel/class/projectModel/btpyvm.py", line 876, in <module>
    pyvm.cmd_install(_v, extended)
File "/www/server/panel/class/projectModel/btpyvm.py", line 719, in cmd_install
    _, err = py_v.install(self.base_url, extended_args)
AttributeError: 'str' object has no attribute 'install'

ping了baidu,也能连接上宝塔


宝塔用户_jixoin 发表于 2025-10-24 01:07:44

离上次检测不足60s,跳过检测!
Stopping Bt-Tasks...    done
Stopping Bt-Panel...    done
Starting Bt-Panel....   done
Starting Bt-Tasks... Bt-Tasks (pid 12396) already running
# ping baidu.com
PING baidu.com (220.181.7.203) 56(84) bytes of data.
64 bytes from 220.181.7.203 (220.181.7.203): icmp_seq=1 ttl=251 time=25.6 ms
64 bytes from 220.181.7.203 (220.181.7.203): icmp_seq=2 ttl=251 time=25.7 ms
64 bytes from 220.181.7.203 (220.181.7.203): icmp_seq=3 ttl=251 time=25.8 ms
64 bytes from 220.181.7.203 (220.181.7.203): icmp_seq=4 ttl=251 time=25.7 ms
^C
--- baidu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 25.687/25.780/25.852/0.059 ms
# curl -I http://download.bt.cn
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 23 Oct 2025 16:48:26 GMT
Content-Type: text/html
Content-Length: 916
Last-Modified: Tue, 10 Jun 2025 03:39:18 GMT
Connection: keep-alive
ETag: "6847a8e6-394"
Strict-Transport-Security: max-age=31536000
Alt-Svc: quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"
Accept-Ranges: bytes

宝塔用户_jixoin 发表于 2025-10-24 01:14:36

还有,能不能手动安装后,在宝塔中指定位置

宝塔用_2f7c 发表于 2025-10-24 19:43:03

/www/server/panel/class/projectModel/btpyvm.py
顶部导入bs4
from bs4 import BeautifulSoup

替换解析代码
def __parser_xml(self, data_txt: str) -> List:
      res_list = []
      
      # data_txt = data_txt.replace("<hr>", "")
   
      last_2 = {
            "data": (2, 0, 0),
            "version": None,
      }

      # root = cElementTree.fromstring(data_txt)
      # for data in root.findall("./body/pre/a"):
      #   v_str = data.text
      #   if v_str.startswith("2."):
      #         ver = v_str.strip("/")
      #         t_version = parse_version_to_list(ver)
      #         if t_version > last_2["data"]:
      #             last_2["data"] = t_version
      #             last_2["version"] = ver
      #         continue
      #   if v_str.startswith("3."):
      #         p_v = PythonVersion(v_str.strip("/"))
      #         res_list.append(p_v)
      #         continue

      soup = BeautifulSoup(data_txt, 'html.parser')
      links = soup.find_all('a')
      for link in links:
            v_str = link.text
            ifv_str.startswith("2."):
                ver = v_str.strip("/")
                t_version = parse_version_to_list(ver)
                if t_version > last_2["data"]:
                  last_2["data"] = t_version
                  last_2["version"] = ver
                continue
            elif v_str.startswith("3."):
                p_v = PythonVersion(v_str.strip("/"))
                res_list.append(p_v)
                continue
            
      if last_2["version"]:
            res_list.insert(0, PythonVersion(last_2["version"]))

      res_list.sort(key=lambda x: x.ver_t)

      need_remove = []
      for ver in res_list[::-1]:
            if not self.test_last_version_is_stable(ver):
                need_remove.append(ver)
            else:
                break
      for ver in need_remove:
            res_list.remove(ver)

      return res_list

阿珂 发表于 2025-10-27 10:17:08

修复面板至最新版,重新安装
页: [1]
查看完整版本: 【已解答】python安装失败,已经是最新版本