![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python报错
萧水雨寒
这个作者很懒,什么都没留下…
展开
-
解决python3.7.8报错TypeError: Unicode-objects must be encoded before hashing的问题
问题描述:python3.7.8版本运行python2.5脚本时报错:TypeError: Unicode-objects must be encoded before hashing问题解析:md5在进行哈希运算前,需要对数据进行编码。解决办法:指定编码格式,进行转码,修改代码如下:# 原代码md5_str = hashlib.md5(path).hexdigest()# 修改代码(进行转码,指定编码格式) md5_str = hashlib.md5((path原创 2021-07-21 17:23:40 · 1197 阅读 · 0 评论 -
解决python3.7.8运行报错AttributeError: module ‘urllib‘ has no attribute ‘urlencode‘
问题描述:python3.7.8运行报错AttributeError: module 'urllib' has no attribute 'urlencode'原因分析:python2和python3的urllib结构不一样python2 python3 import urllib2 import urllib.request,urllib.error import urllib import urllib.request,urllib.error,urlli.原创 2021-05-17 11:19:22 · 2939 阅读 · 0 评论 -
解决python运行报错 :ValueError: check_hostname requires server_hostname
问题描述:python运行报错 :ValueError: check_hostname requires server_hostname原因分析:开启fiddler时自动打开了代理服务器解决办法:关闭代理服务器原创 2021-05-14 14:09:09 · 3942 阅读 · 5 评论 -
解决UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa8 in position 46: illegal multibyte sequence
问题描述:python3.7.8运行脚本(脚本中调用了log.conf配置表)时报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa8 in position 46: illegal multibyte sequence问题解析:'gbk'中文编码问题,log.conf 配置表中含有中文字符解决方法:将log.conf配置表中的中文字符删除,重新运行脚本,问题解决...原创 2021-01-11 18:51:49 · 3477 阅读 · 0 评论 -
Python启动定时任务监听器-执行命令celery beat时报错ERROR: Pidfile (celerybeat.pid) already exists.
报错描述:在启动定时任务监听器-执行命令python manage.py celery beat --loglevel=info 时报错,ERROR: Pidfile (celerybeat.pid) already exists.E:\HttpRunnerManager>python manage.py celery beat --loglevel=infocelery beat v4.4.7 (cliffs) is starting.ERROR: Pidfile (celeryb原创 2020-09-16 01:52:35 · 933 阅读 · 1 评论 -
解决AttributeError: module ‘tornado.web‘ has no attribute ‘asynchronous‘的问题
问题描述:Python执行命令python manage.py celery -A HttpRunnerManager worker --loglevel=info启动worker,tornado报错:AttributeError: module 'tornado.web' has no attribute 'asynchronous' File "C:\Python3.7.8\lib\site-packages\flower\api\tasks.py", line 83, in TaskA原创 2020-09-13 10:47:29 · 5681 阅读 · 0 评论 -
解决hrun运行yaml文件报错httprunner.cli:main_run:49 - No valid testcases found, exit 1.
问题描述:httprunner版本:3.1.4har2case -V0.3.1yaml文件如下:- config: name: httpbin api test request: base_url: http://www.httpbin.org- test: name: get request request: url: /get meth原创 2020-09-05 11:45:31 · 3913 阅读 · 17 评论 -
python导入模块报错ImportError: No module named djcelery
问题描述:python导入djcelery模块报错ImportError: No module named djcelery>>> import djceleryImportError: No module named djcelery原因分析:djcelery模块已更名为django-celery解决方法:在安装该模块时需使用命令pip install django-celerypip install -i https://pypi.tuna.tsin原创 2020-09-10 18:13:45 · 4358 阅读 · 2 评论 -
解决pip安装mysqlclient报错error C1083: Cannot open include file: ‘mysql.h‘: No such file or directory
问题描述:系统:win10(64位)python版本:3.7.8MySQL Server 8.0MySQL Connector C 6.1使用pip install -r requirements.txt 命令时,安装到mysqlclient时报错(mysqlclient已通过pip命令安装完成): ERROR: Command errored out with exit status 1: command: 'c:\python3.7.8\python.exe' -u ...原创 2020-09-10 17:24:08 · 5298 阅读 · 0 评论 -
解决win10中Microsoft Visual C++ 14.0 is required.
问题描述:win10系统中,python环境下使用pip命令pip install -r requirements.txt报错:Microsoft Visual C++ 14.0 is required.OS : Windows 10Python Version : 3.7.8command used : pip install -r requirements.txterror: Microsoft Visual C++ 14.0 is required. Get it with "Mic原创 2020-09-10 15:54:34 · 3286 阅读 · 0 评论 -
解决PyCharm安装成功后提示Error: Please select a valid Python interpreter 的问题no interpreter
https://blog.csdn.net/qq_37437892/article/details/80988856Cannot set up a python SDK at Python 3.9 (C:\Users\Administrator\AppData\Local\Microsoft\WindowsApp运行python脚本报错提示:No module named 'requests'检查是否已安装requests,参见:https://blog.cs...原创 2020-09-06 11:36:46 · 9326 阅读 · 0 评论 -
解决YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is u
问题描述:python脚本读取yaml文件时提示警告信息YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe.Please read https://msg.pyyaml.org/load for full details. yaml_dict = yaml.load(f)原因分析:yaml5.1版本后弃用了yaml.load(fi...原创 2020-09-06 11:20:24 · 7583 阅读 · 0 评论 -
解决Error running ‘serializers‘: Cannot run program“url...“:CreateProcess error=2, 系统找不到指定的文件。
Error running 'serializers': Cannot run program "C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps\python.exe" (in directory "E:\django_restful\api"):原创 2020-09-05 15:38:57 · 1193 阅读 · 0 评论 -
Pycharm提示Instance attribute users_index defined outside __init__
问题描述:Pycharm提示Instance attribute users_index defined outside __init__示例代码:class UserBehavior(TaskSet): def on_start(self): self.users_index = 0 #会出现下划线提示Instance attribute users_index defined outside __init__ self.group原创 2020-08-30 13:01:38 · 4222 阅读 · 0 评论 -
解决python3.7+locust1.0性能测试报错
问题描述:python3.7.8+locust1.0,性能测试运行过程中接口测试请求为空。运行测试脚本报错如下::\Python3.7.8\python.exe C:/Users/Administrator/Desktop/api_test/locust/restful_api_locust.pyC:\Python3.7.8\lib\site-packages\locust\util\deprecation.py:14: DeprecationWarning: Usage of User.task原创 2020-08-28 10:50:35 · 4198 阅读 · 1 评论 -
使用pip install locustio安装locust报错ERROR: No matching distribution found for locustio的问题
问题描述:使用pip install locustio安装locust报错,ERROR: Could not find a version that satisfies the requirement locustio (from versions: none)ERROR: No matching distribution found for locustio原因解析:pip安装没有找到locustio, 没有下载locustio解决方法:1、官网下载安装,地址:https://原创 2020-08-27 14:18:34 · 3254 阅读 · 0 评论 -
pymysql.err.ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that co
问题描述:Django数据管理((python/mysql))-yaml封装初始化数据python运行mysql_action.py脚本时报错:pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups)原创 2020-08-27 12:48:57 · 2052 阅读 · 0 评论 -
解决pymysql.err.OperationalError: (1364, “Field ‘groups‘ doesn‘t have a default value“) 写入字段默认值不能为空的问题
问题描述:python在对数据库的api_user表进行操作的时候,报错:pymysql.err.OperationalError: (1364, "Field 'groups' doesn't have a default value"),数据库写入不成功。问题解析:写入数据时groups字段没有默认值,groups字段定义应该是不能为空,即不是null。(可以通过Navicat查看api_user的设计表查看该表中各个字段的定义),如下:解决方法:1、检查python脚本中.原创 2020-08-27 11:55:14 · 5397 阅读 · 0 评论 -
解决FileNotFoundError: [Errno 2] No such file or directory: ‘datas.yaml‘的问题
问题描述:在脚本中加载文件f = open('datas.yaml', 'r')运行脚本时提示FileNotFoundError: [Errno 2] No such file or directory: 'datas.yaml'原因分析:文件路径有问题,datas.yaml文件与当前运行脚本不在同一目录下。(没有指定路径直接加载文件时,加载的文件路径需要与当前脚本的路径一致,在同一目录下)解决方法:方法1:确认当前脚本路径和datas.yaml文件路径是否一致,将dat原创 2020-08-20 11:23:20 · 23574 阅读 · 3 评论 -
解决(win10)Pycharm中运行脚本提示“Python was not found but can be installed from the Microsoft Store:”的问题
报错提示:Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640Error running 'serializers': Cannot run program "C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps\python.exe" (in di.原创 2020-08-14 15:18:12 · 8421 阅读 · 1 评论 -
Python ImportError: No module named ‘selenium‘
解决方法:进到PyCharm的解释器设置,发现自己电脑上原来安装了两个python程序。我自己使用的是c盘根目录下面的。但PyCharm里面使用的是program files下面的那个,所以根本找不到我自己后来安装的module,这里重新选择c盘根目录下面正确的,然后PyCharm就好索引新安装的module,之后写的程序里就可以识别了。其实一开始的报错里已经写明了pyth...原创 2019-11-05 17:37:58 · 513 阅读 · 0 评论