pip install -U selenium 报错为啥呢?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pip install -U selenium 报错为啥呢?相关的知识,希望对你有一定的参考价值。
c:\Python27\Lib\site-packages>pipinstall -U selenium
Downloading/unpacking selenium fromhttps://pypi.python.org/packages/source/s/selenium/selenium-2.43.0.tar.gz#md5=bf2b46caa5c1ea4b68434809c695d69b
Cleaning up...
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line122, in main status =self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\install.py",line 279, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle,bundle=self.bundle)
File "c:\python27\lib\site-packages\pip\req.py", line 1230, inprepare_files req_to_install.run_egg_info()
File "c:\python27\lib\site-packages\pip\req.py", line 293, inrun_egg_info logger.notify('Runningsetup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "c:\python27\lib\site-packages\pip\req.py", line 266, insetup_py
import setuptools
File "c:\python27\lib\site-packages\setuptools\__init__.py",line 12, in <module>
from setuptools.extension import Extension
File "c:\python27\lib\site-packages\setuptools\extension.py",line 7, in <module>
from setuptools.dist import _get_unpatched
File "c:\python27\lib\site-packages\setuptools\dist.py", line16, in <module>
from setuptools.compat import numeric_types, basestring
File "c:\python27\lib\site-packages\setuptools\compat.py",line 19, in <module>
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in<module>
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\SimpleHTTPServer.py", line 208, inSimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\mimetypes.py", line 363, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 258, inread_windows_registry
sys.getdefaultencoding('gbk')
TypeError: getdefaultencoding() takes noarguments (1 given)
Storing debug log for failure inC:\Users\wangchao\pip\pip.log
1安装selenium和浏览器驱动
1、安装selenium
1)win下win键 + r 打开运行界面,并输入CMD,点击确定
2)输入 pip install selenium 按回车
ps:我这边已经下载过了,就不重复下载了,如果没有报错,等待执行完毕即可
3)验证是否安装成功
输入:pip show selenium
显示以上信息则说明安装成功
3、浏览器驱动安装(谷歌浏览器)
1)查看浏览器版本(我的为83.0.4)
2)打开页面:http://chromedriver.storage.googleapis.com/index.html 找到83对应等驱动,个人不建议下载最新版,可能会存在bug
3)点击对应的文件夹,下载对应的系统
4)下载之后解压,存放到python目录下,并双击一次即可
python的安装:https://www.runoob.com/w3cnote/pycharm-windows-install.html
以上是关于pip install -U selenium 报错为啥呢?的主要内容,如果未能解决你的问题,请参考以下文章
pip install selenium 无法安装问题解决办法
Selenium_pip安装selenium报Read time out