python用pip安装selenium过程中的问题
2020-08-01 17:21:47 来源:易采站长站 作者:
python环境:anaconda+win10
开始学习爬虫,但是在第一天就遇到了大问题,在命令行安装selenium一直提示下列SSL有问题:WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available………… No matching distribution found for selenium
于是我开始了问度娘,有问题找度娘嘛。可是找啊找,网上的答案主要是:
方法1:增大超时时间
pip –default-timeout=100 install selenium
方法2:修改安装源为清华安装源
pip install –index https://mirrors.ustc.edu.cn/pypi/web/simple/ selenium
我一个个尝试后发现依然解决不了问题,于是开始自己各种在花样百度,找呀找呀,终于发现原来是我的python环境没有激活导致的。现在知道原因了这还不好解决吗。
解决方法:
1.打开命令行,输入activate base
2.这就进入到python环境中去了,再输入pip install selenium,可是再一次出现了问题:
Downloading selenium-3.141.0-py2.py3-none-any.whl (904 kB)
|█ | 30 kB 1.1 kB/s eta 0:13:18ERROR: Exception:
Traceback (most recent call last):
File “D:installanacondalibsite-packagespip_vendorurllib3response.py”, line 425, in _error_catcher
yield
File “D:installanacondalibsite-packagespip_vendorurllib3response.py”, line 507, in read
data = self._fp.read(amt) if not fp_closed else b””
File “D:installanacondalibsite-packagespip_vendorcachecontrolfilewrapper.py”, line 62, in read
data = self.__fp.read(amt)
File “D:installanacondalibhttpclient.py”, line 457, in read
n = self.readinto(b)
File “D:installanacondalibhttpclient.py”, line 501, in readinto
n = self.fp.readinto(b)
File “D:installanacondalibsocket.py”, line 589, in readinto
return self._sock.recv_into(b)
File “D:installanacondalibssl.py”, line 1071, in recv_into
return self.read(nbytes, buffer)
File “D:installanacondalibssl.py”, line 929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “D:installanacondalibsite-packagespip_internalclibase_command.py”, line 186, in _main
status = self.run(options, args)
File “D:installanacondalibsite-packagespip_internalcommandsinstall.py”, line 331, in run
resolver.resolve(requirement_set)
File “D:installanacondalibsite-packagespip_internallegacy_resolve.py”, line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File “D:installanacondalibsite-packagespip_internallegacy_resolve.py”, line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File “D:installanacondalibsite-packagespip_internallegacy_resolve.py”, line 282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File “D:installanacondalibsite-packagespip_internaloperationsprepare.py”, line 482, in prepare_linked_requirement
hashes=hashes,
File “D:installanacondalibsite-packagespip_internaloperationsprepare.py”, line 287, in unpack_url
hashes=hashes,
File “D:installanacondalibsite-packagespip_internaloperationsprepare.py”, line 159, in unpack_http_url
link, downloader, temp_dir.path, hashes
File “D:installanacondalibsite-packagespip_internaloperationsprepare.py”, line 303, in _download_http_url
for chunk in download.chunks:
File “D:installanacondalibsite-packagespip_internalutilsui.py”, line 160, in iter
for x in it:
File “D:installanacondalibsite-packagespip_internalnetworkutils.py”, line 39, in response_chunks
decode_content=False,
File “D:installanacondalibsite-packagespip_vendorurllib3response.py”, line 564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File “D:installanacondalibsite-packagespip_vendorurllib3response.py”, line 529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File “D:installanacondalibcontextlib.py”, line 130, in __exit__
self.gen.throw(type, value, traceback)
File “D:installanacondalibsite-packagespip_vendorurllib3response.py”, line 430, in _error_catcher
raise ReadTimeoutError(self._pool, None, “Read timed out.”)
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Read timed out.
下载的好好的,为什么有一子又出现了问题呢?
3.哎,好事多磨哦,于是我猜测是不是外网的问题?果断换了一个下载源。
在命令行中输入以下命令:
pip install selenium -i https://pypi.douban.com/simple
按下确定键后:
Downloading https://pypi.doubanio.com/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl (904 kB)
|████████████████████████████████| 904 kB 1.3 MB/s
Requirement already satisfied: urllib3 in d:installanacondalibsite-packages (from selenium) (1.25.8)
Installing collected packages: selenium
Successfully installed selenium-3.141.0
圆满完成下载任务。
作者:离愁无语说













闽公网安备 35020302000061号