windows使用pip安装selenium报错问题

UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xb9 in position 7: ordinal not in range(128)

这是编码问题,需要在你的python安装目录下

这是我的安装目录C:\Python27\Lib\site-packages

添加sitecustomize.py文件

文件内容添加

import sys
sys.setdefaultencoding(‘gb2312‘)

之后在执行pip install -U selenium安装就不会报错啦

sys.setdefaultencoding是python设置系统默认编码,python会在下次自动运行这个文件sitecustomize.py

原文地址:https://www.cnblogs.com/JahanGu/p/8337813.html

时间: 2024-08-29 04:41:46

windows使用pip安装selenium报错问题的相关文章

pip安装selenium报错:Read timed out

今天打算把selenium降级重新安装,发现安装时总是失败,报如下错误: raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.py thon.org', port=443): Read timed out. 原因是超时了,解决方法:安装

Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat(转载)

Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat 刚在机器上windows环境下装上pip方便以后安装包的时候使用,谁知道第一次使用pip安装asyncio的时候就报错. 在Windows7x64下使用pip安装包的时候提示报错:Microsoft Visual C++ 9.0 is required  (Unable to find vcvarsall.bat) 环境:windo

pip安装requests报错unicodeEncodeError:'ascii' codec can\t encode charactesers in position 9-12:ordinal not in range(128)

前提 : 已经安装pip(pip的安装我参考的是本博客转载脚本之家的步骤,实验可以成功) 1. 在cmd输入命令转到pip安装目录: 2. 运行后出现错误 3. 步骤2中的错误应该和编码有关.搜索百度后,解决方法: 转自:joy32812 在你python的安装目录下的Lib目录,找到site.py,修改def setencoding()方法def setencoding(): ..... .... if 0: # Enable to support locale aware default s

memcached 笔记之windows 7 下面 安装memcached 报错

windows 7 下面 安装memcached 报错 两种情况: 一:服务确实已经安装过 .如需要重新安装,当然是先memcached.exe -d uninstall 二:奇怪的是服务确实没有安装过的情况,在memcached.exe -d install也会出现上面定位报错.此时关掉cmd窗口  然后以管理员身份运行cmd,在执行上面的install,不出意外你会顺利的执行成功. 常用命令: 安装.卸载.启动.配置相关 -p 监听的端口 -l 连接的IP地址, 默认是本机 -d start

python pip安装 mysqlclient 报错 raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_config not found

raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_config not found 解决办法 yum install mysql-devel python pip安装 mysqlclient 报错 raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_confi

pip安装ujson报错: error:Microsoft Visual C++ 14.0 is required

在win10上pip安装ujson报错 之前一直用的是mac本,但由于疫情问题,最近不得不用win10系统来进行python开发,在使用pip安装依赖包ujson时,遇到了问题,如下: (custom_itsm) D:\DEVELOP\items\hn_test>pip install ujson DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python

pip安装mysql_python报错

_mysql.c:29:20: fatal error: Python.h: No such file or directory #include "Python.h" ^ compilation terminated. error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python2 -u -c "imp

pip 安装pycrypto 报错

pip 安装pycrypto 报src/MD2.c:31:20: error: Python.h: No such file or directory 错误解决 gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -f

pip 安装mysqlclient报错OSError: mysql_config not found

执行 pip install mysqlclient 报错信息如下: [[email protected] bin]# pip install mysqlclient Collecting mysqlclient Using cached mysqlclient-1.3.12.tar.gz Complete output from command python setup.py egg_info: /bin/sh: mysql_config: command not found Tracebac