首页 > 编程语言 >Java成神之路-踩坑篇: SpringBoot2.7.0版本整合Swagger3.0.0。解决:项目启动报错与swagger-ui.html请求404无法访问

Java成神之路-踩坑篇: SpringBoot2.7.0版本整合Swagger3.0.0。解决:项目启动报错与swagger-ui.html请求404无法访问

时间:2024-09-13 10:51:26浏览次数:12  
标签:SpringBoot2.7 java apple repository spring 无法访问 jar 报错 Users

话不多说先上报错信息

Caused by: java.lang.NullPointerException: null
	at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
	at springfox.documentation.RequestHandler.sortedPaths(RequestHandler.java:113) ~[springfox-core-3.0.0.jar:3.0.0]
	at springfox.documentation.spi.service.contexts.Orderings.lambda$byPatternsCondition$3(Orderings.java:89) ~[springfox-spi-3.0.0.jar:3.0.0]
	at java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469) ~[na:1.8.0_361]
	at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:1.8.0_361]
	at java.util.TimSort.sort(TimSort.java:220) ~[na:1.8.0_361]
	at java.util.Arrays.sort(Arrays.java:1512) ~[na:1.8.0_361]
	at java.util.ArrayList.sort(ArrayList.java:1464) ~[na:1.8.0_361]
	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:387) ~[na:1.8.0_361]
	at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:1.8.0_361]
	at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:1.8.0_361]
	at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:1.8.0_361]
	at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_361]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_361]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_361]
	at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:81) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_361]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_361]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_361]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_361]
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.withDefaults(AbstractDocumentationPluginsBootstrapper.java:107) ~[springfox-spring-web-3.0.0.jar:3.0.0]
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.buildContext(AbstractDocumentationPluginsBootstrapper.java:91) ~[springfox-spring-web-3.0.0.jar:3.0.0]
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:82) ~[springfox-spring-web-3.0.0.jar:3.0.0]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:100) ~[springfox-spring-web-3.0.0.jar:3.0.0]
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.20.jar:5.3.20]
	... 14 common frames omitted

炸一看,springboot启动居然报NullPointerException

淡定!云中之龙,亦有其渊。遇到问题不要慌,总能解决的

仔细看其中一行错误信息为

	at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:81) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_361]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_361]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_361]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_361]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_361]

此时从报错信息可以确定问题是由Swagger引起 (如果不确定可以移除Swagger依赖,重新刷新Maven,再启动如果此时没有报错,即可定位问题在Swagger)

此时带着问题到小du搜索

springboot中的application.yml中加入以下配置即可:

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

成功启动项目

/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/bin/java -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dmanagement.endpoints.jmx.exposure.include=* -Dhxl.spring.invoke.port=33333 -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=50250:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home/jre/lib/rt.jar:/Users/apple/Documents/deletedProject/ksy-hd/ksy-files/target/classes:/Users/apple/repository/io/springfox/springfox-boot-starter/3.0.0/springfox-boot-starter-3.0.0.jar:/Users/apple/repository/io/springfox/springfox-oas/3.0.0/springfox-oas-3.0.0.jar:/Users/apple/repository/io/swagger/core/v3/swagger-annotations/2.1.2/swagger-annotations-2.1.2.jar:/Users/apple/repository/io/swagger/core/v3/swagger-models/2.1.2/swagger-models-2.1.2.jar:/Users/apple/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.3/jackson-annotations-2.13.3.jar:/Users/apple/repository/io/springfox/springfox-spi/3.0.0/springfox-spi-3.0.0.jar:/Users/apple/repository/io/springfox/springfox-schema/3.0.0/springfox-schema-3.0.0.jar:/Users/apple/repository/io/springfox/springfox-core/3.0.0/springfox-core-3.0.0.jar:/Users/apple/repository/net/bytebuddy/byte-buddy/1.12.10/byte-buddy-1.12.10.jar:/Users/apple/repository/io/springfox/springfox-spring-web/3.0.0/springfox-spring-web-3.0.0.jar:/Users/apple/repository/io/github/classgraph/classgraph/4.8.83/classgraph-4.8.83.jar:/Users/apple/repository/io/springfox/springfox-spring-webmvc/3.0.0/springfox-spring-webmvc-3.0.0.jar:/Users/apple/repository/io/springfox/springfox-spring-webflux/3.0.0/springfox-spring-webflux-3.0.0.jar:/Users/apple/repository/io/springfox/springfox-swagger-common/3.0.0/springfox-swagger-common-3.0.0.jar:/Users/apple/repository/org/mapstruct/mapstruct/1.3.1.Final/mapstruct-1.3.1.Final.jar:/Users/apple/repository/io/springfox/springfox-data-rest/3.0.0/springfox-data-rest-3.0.0.jar:/Users/apple/repository/io/springfox/springfox-bean-validators/3.0.0/springfox-bean-validators-3.0.0.jar:/Users/apple/repository/io/springfox/springfox-swagger2/3.0.0/springfox-swagger2-3.0.0.jar:/Users/apple/repository/io/swagger/swagger-annotations/1.5.20/swagger-annotations-1.5.20.jar:/Users/apple/repository/io/swagger/swagger-models/1.5.20/swagger-models-1.5.20.jar:/Users/apple/repository/io/springfox/springfox-swagger-ui/3.0.0/springfox-swagger-ui-3.0.0.jar:/Users/apple/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/Users/apple/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:/Users/apple/repository/org/springframework/plugin/spring-plugin-core/2.0.0.RELEASE/spring-plugin-core-2.0.0.RELEASE.jar:/Users/apple/repository/org/springframework/spring-beans/5.3.20/spring-beans-5.3.20.jar:/Users/apple/repository/org/springframework/spring-context/5.3.20/spring-context-5.3.20.jar:/Users/apple/repository/org/springframework/spring-aop/5.3.20/spring-aop-5.3.20.jar:/Users/apple/repository/org/springframework/plugin/spring-plugin-metadata/2.0.0.RELEASE/spring-plugin-metadata-2.0.0.RELEASE.jar:/Users/apple/repository/cn/dev33/sa-token-spring-boot-starter/1.32.0/sa-token-spring-boot-starter-1.32.0.jar:/Users/apple/repository/cn/dev33/sa-token-servlet/1.32.0/sa-token-servlet-1.32.0.jar:/Users/apple/repository/cn/dev33/sa-token-core/1.32.0/sa-token-core-1.32.0.jar:/Users/apple/repository/mysql/mysql-connector-java/8.0.22/mysql-connector-java-8.0.22.jar:/Users/apple/repository/org/springframework/boot/spring-boot-starter-validation/2.7.0/spring-boot-starter-validation-2.7.0.jar:/Users/apple/repository/org/springframework/boot/spring-boot-starter/2.7.0/spring-boot-starter-2.7.0.jar:/Users/apple/repository/org/springframework/boot/spring-boot/2.7.0/spring-boot-2.7.0.jar:/Users/apple/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.0/spring-boot-autoconfigure-2.7.0.jar:/Users/apple/repository/org/springframework/boot/spring-boot-starter-logging/2.7.0/spring-boot-starter-logging-2.7.0.jar:/Users/apple/repository/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar:/Users/apple/repository/ch/qos/logback/logback-core/1.2.11/logback-core-1.2.11.jar:/Users/apple/repository/org/apache/logging/log4j/log4j-to-slf4j/2.17.2/log4j-to-slf4j-2.17.2.jar:/Users/apple/repository/org/apache/logging/log4j/log4j-api/2.17.2/log4j-api-2.17.2.jar:/Users/apple/repository/org/slf4j/jul-to-slf4j/1.7.36/jul-to-slf4j-1.7.36.jar:/Users/apple/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/apple/repository/org/springframework/spring-core/5.3.20/spring-core-5.3.20.jar:/Users/apple/repository/org/springframework/spring-jcl/5.3.20/spring-jcl-5.3.20.jar:/Users/apple/repository/org/yaml/snakeyaml/1.30/snakeyaml-1.30.jar:/Users/apple/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.63/tomcat-embed-el-9.0.63.jar:/Users/apple/repository/org/hibernate/validator/hibernate-validator/6.2.3.Final/hibernate-validator-6.2.3.Final.jar:/Users/apple/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/Users/apple/repository/org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar:/Users/apple/repository/cn/hutool/hutool-all/5.8.9/hutool-all-5.8.9.jar:/Users/apple/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar:/Users/apple/repository/org/springframework/boot/spring-boot-starter-web/2.7.0/spring-boot-starter-web-2.7.0.jar:/Users/apple/repository/org/springframework/boot/spring-boot-starter-json/2.7.0/spring-boot-starter-json-2.7.0.jar:/Users/apple/repository/com/fasterxml/jackson/core/jackson-databind/2.13.3/jackson-databind-2.13.3.jar:/Users/apple/repository/com/fasterxml/jackson/core/jackson-core/2.13.3/jackson-core-2.13.3.jar:/Users/apple/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.13.3/jackson-datatype-jdk8-2.13.3.jar:/Users/apple/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.3/jackson-datatype-jsr310-2.13.3.jar:/Users/apple/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.13.3/jackson-module-parameter-names-2.13.3.jar:/Users/apple/repository/org/springframework/boot/spring-boot-starter-tomcat/2.7.0/spring-boot-starter-tomcat-2.7.0.jar:/Users/apple/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.63/tomcat-embed-core-9.0.63.jar:/Users/apple/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.63/tomcat-embed-websocket-9.0.63.jar:/Users/apple/repository/org/springframework/spring-web/5.3.20/spring-web-5.3.20.jar:/Users/apple/repository/org/springframework/spring-webmvc/5.3.20/spring-webmvc-5.3.20.jar:/Users/apple/repository/org/springframework/spring-expression/5.3.20/spring-expression-5.3.20.jar:/Users/apple/repository/com/alibaba/fastjson/1.2.76/fastjson-1.2.76.jar:/Users/apple/.config/.cool-request/request/lib/spring-invoke-starter.jar com.ksy.files.FilesApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.0)

2024-09-13 09:47:05.836  INFO 32150 --- [           main] com.ksy.files.FilesApplication           : Starting FilesApplication using Java 1.8.0_361 on hanyu-Mac-mini with PID 32150 (/Users/apple/Documents/deletedProject/ksy-hd/ksy-files/target/classes started by apple in /Users/apple/Documents/deletedProject/ksy-hd)
2024-09-13 09:47:05.838  INFO 32150 --- [           main] com.ksy.files.FilesApplication           : The following 1 profile is active: "dev"
2024-09-13 09:47:07.052  INFO 32150 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9002 (http)
2024-09-13 09:47:07.058  INFO 32150 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-09-13 09:47:07.058  INFO 32150 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.63]
2024-09-13 09:47:07.198  INFO 32150 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-09-13 09:47:07.198  INFO 32150 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1313 ms
____ ____    ___ ____ _  _ ____ _  _ 
[__  |__| __  |  |  | |_/  |___ |\ | 
___] |  |     |  |__| | \_ |___ | \| 
https://sa-token.cc (v1.32.0)
2024-09-13 09:47:08.026  INFO 32150 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9002 (http) with context path ''
2024-09-13 09:47:08.094  INFO 32150 --- [           main] com.ksy.files.FilesApplication           : Started FilesApplication in 2.783 seconds (JVM running for 3.976)

访问http://localhost:9002/swagger-ui/index.html成功(端口换成你自己的)

标签:SpringBoot2.7,java,apple,repository,spring,无法访问,jar,报错,Users
From: https://blog.csdn.net/HMM119/article/details/142201865

相关文章

  • springcloud项目中学习&&各种报错
    springcloud项目中maven依赖报错Non-resolvableimportPOM直接删除pom依赖中的《type》import即可——然后你会惊奇的发现springcloudalibaba的相关组件不添加版本会无法使用;但,在这时候你重新把这个《type》加入之后,哎,一切都好了,不会报错也正常使用(滑稽)Nacos发行版本安......
  • 3par之CRC报错
    故障现象某客户反映,通过IMC管理软件查看到3par8200存储的两个端口:0:0:1和0:0:2,有大量的CRC相关告警,为了保障存储链路稳定,请求处理此故障。故障分析8200cli%showportlesbsingle0:0:1#显示HP3PAR存储系统中端口状态和统计信息IDALPA----Port_WWN----Li......
  • Redis常见报错及解决方法总结
    Redis常见报错及解决方法总结Redis作为高效的内存数据库,在实际使用过程中不可避免会遇到一些问题和报错。为了帮助大家更好地应对这些问题,我将常见的Redis报错及其解决方法进行总结,并提供具体的操作步骤。1.ConnectionRefused错误描述:客户端连接Redis时,出现Connection......
  • PbootCMS网站转移后无法打开报错提示“No input file specifed”
    当PBootCMS网站在转移服务器后出现“Noinputfilespecified”的错误提示时,这通常是由于某些配置或文件问题导致的。以下是可能导致此错误的一些原因及解决方法:检查.user.ini文件:检查根目录是否含有.user.ini文件,如果有,请尝试删除该文件,然后重新访问站点。重启Web服务器......
  • PbootCMS附件上传失败报错UNKNOW: Code: 8192; Desc: stripos()
    在PBootCMS中遇到附件上传失败的报错 UNKNOW:Code:8192;Desc:stripos():Non-stringneedleswillbeinterpretedasstringsinthefuture.Useanexplicitchr()calltopreservethecurrentbehavior,这通常是因为PHP版本升级后某些函数的行为发生了变化。具体来说,st......
  • 单选和多选在table里的报错问题Blocked aria-hidden on a <input> element because the
    单选在main.js里//table单选报错问题Vue.directive('removeAriaHidden',{bind(el,binding){constariaEls=el.querySelectorAll('.el-radio__original')ariaEls.forEach((item)=>{item.removeAttribute('aria-hidden')......
  • Python打包完成后报错,如何解决?
    大家好,我是Python进阶者。一、前言前几天在Python最强王者交流群【钟爱一生】问了一个Python打包处理数据的问题,问题如下:打包完成后报错:发生错误:Missingoptionaldependency'openpyxl'.Usepiporcondatoinstallopenpyxl.哪位大佬帮我看一下错在哪了?二、实现过程后来......
  • 开启PDB时报错ORA-00800、ORA-65054
    问题描述:开启PDB时报错ORA-00800、ORA-65054,如下所示:数据库信息:账务库备库1节点IP:192.168.133.183实例名:tmis1版本:oracle19.201、告警信息2024-09-10T22:19:44.336563+08:00Errorsinfile/u01/app/oracle/diag/rdbms/tmisdg/tmis1/trace/tmis1_vktm_152164.trc(inciden......
  • # yyds干货盘点 # Python打包完成后报错,如何解决?
    大家好,我是Python进阶者。一、前言前几天在Python最强王者交流群【钟爱一生】问了一个Python打包处理数据的问题,问题如下:打包完成后报错:发生错误:Missingoptionaldependency'openpyxl'.Usepiporcondatoinstallopenpyxl.哪位大佬帮我看一下错在哪了?二、实现过程后来【隔壁......
  • 【Linux】解决无法ping通或者安装报错的问题
    关于pingwww.baidu.com不通的问题首先你需要root权限然后去修改网络解析配置:sudovim/etc/resolv.conf在后面加上nameserver8.8.8.8nameserver8.8.4.4保存后重启网络服务sudo/etc/init.d/networkingrestart如果在使用pip安装库的时候出现错误:WARNING:Ret......