安装jieba库失败

本文解决了通过代理时无法使用pip命令升级的问题。作者尝试了多种方法最终发现只需关闭网络代理即可成功执行pip升级操作。

You should consider upgrading via the ‘d:\python37\python.exe -m pip install --upgrade pip’ command.

试了csdn上的各种方法,最后在某评论区找到答案。
笑死,关掉代理就好了。
意思是关掉翻墙。
牛哇牛哇。

是在这里的评论区:https://blog.youkuaiyun.com/liboshi123/article/details/116078509

package com.example.jieba6wk.entity; import java.util.Date; public class Character { private Integer characterId; private String characterName; private String height; private String weight; private String origin; private String fightingStyle; private String coreSkill; private String difficulty; private String voiceActor; private String characterImages; // 原JSON字符串(["url"]) private String pureImageUrl; // 新增:解析后的纯URL(如 https://xxx.png) private Date updateTime; // 原有 Getter + Setter 保留,新增 pureImageUrl 的 Getter + Setter public String getPureImageUrl() { return pureImageUrl; } public void setPureImageUrl(String pureImageUrl) { this.pureImageUrl = pureImageUrl; } // 全量 Getter + Setter 方法 public Integer getCharacterId() { return characterId; } public void setCharacterId(Integer characterId) { this.characterId = characterId; } public String getCharacterName() { return characterName; } public void setCharacterName(String characterName) { this.characterName = characterName; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getWeight() { return weight; } public void setWeight(String weight) { this.weight = weight; } public String getOrigin() { return origin; } public void setOrigin(String origin) { this.origin = origin; } public String getFightingStyle() { return fightingStyle; } public void setFightingStyle(String fightingStyle) { this.fightingStyle = fightingStyle; } public String getCoreSkill() { return coreSkill; } public void setCoreSkill(String coreSkill) { this.coreSkill = coreSkill; } public String getDifficulty() { return difficulty; } public void setDifficulty(String difficulty) { this.difficulty = difficulty; } public String getVoiceActor() { return voiceActor; } public void setVoiceActor(String voiceActor) { this.voiceActor = voiceActor; } public String getCharacterImages() { return characterImages; } public void setCharacterImages(String characterImages) { this.characterImages = characterImages; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } } package com.example.jieba6wk.servlet; import com.alibaba.fastjson.JSONArray; import com.example.jieba6wk.entity.Character; import com.example.jieba6wk.mapper.CharacterMapper; import com.example.jieba6wk.util.MyBatisUtil; import org.apache.ibatis.session.SqlSession; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @WebServlet("/roleCategory") public class CharacterListServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (SqlSession sqlSession = MyBatisUtil.getSqlSession()) { CharacterMapper mapper = sqlSession.getMapper(CharacterMapper.class); List<Character> characterList = mapper.findAll(); // 关键:后端解析图片URL(将 ["url"] 转成纯URL) for (Character character : characterList) { String jsonStr = character.getCharacterImages(); if (jsonStr != null && !jsonStr.isEmpty()) { // 解析JSON数组,获取第一个元素(纯URL) JSONArray jsonArray = JSONArray.parseArray(jsonStr); if (jsonArray.size() > 0) { String pureUrl = jsonArray.getString(0); character.setPureImageUrl(pureUrl); // 存入纯URL字段 } else { character.setPureImageUrl("https://placeholder.com/default.png"); // 默认图 System.out.println("角色:" + character.getCharacterName() + ",使用默认图"); } } else { character.setPureImageUrl("https://placeholder.com/default.png"); // 默认图 System.out.println("角色:" + character.getCharacterName() + ",无图片,使用默认图"); } } request.setAttribute("characterList", characterList); request.getRequestDispatcher("/roleCategory.jsp").forward(request, response); } catch (Exception e) { System.err.println("角色列表查询失败:"); e.printStackTrace(); response.getWriter().write("服务器内部错误:" + e.getMessage()); } } } <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <head> <title>街霸6角色列表</title> <style> .role-card { border: 1px solid #ccc; border-radius: 8px; padding: 15px; margin: 15px; display: inline-block; width: 280px; vertical-align: top; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .role-image { width: 100%; height: 200px; object-fit: cover; border-radius: 4px; margin-bottom: 10px; } .role-info { text-align: left; margin-bottom: 15px; } .detail-btn { padding: 8px 20px; background-color: #2c3e50; color: white; border: none; border-radius: 4px; cursor: pointer; text-decoration: none; } .detail-btn:hover { background-color: #34495e; } </style> </head> <body> <h1 style="text-align: center;">街霸6列表</h1> <c:forEach items="${characterList}" var="char"> <div class="role-card"> <!-- 直接使用后端解析好的纯URL,无复杂表达式 --> <img class="role-image" src="${char.pureImageUrl}" alt="${char.characterName}"> <div class="role-info"> <h3>${char.characterName}</h3> <p>出身:${char.origin}</p> <p>格斗风格:${char.fightingStyle}</p> <!-- 修复EL表达式条件优先级(添加括号) --> <p>难度:<span style="color: ${char.difficulty == '新手' ? 'green' : (char.difficulty == '进阶' ? 'orange' : 'red')}">${char.difficulty}</span></p> </div> <a href="/characterDetail?characterId=${char.characterId}" class="detail-btn">查看详情</a> </div> </c:forEach> </body> </html>根据以上的问题,解析以上的代码,并提出解决方案
最新发布
11-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值