pip install pip
通过下面的一番实践,pip 9.0——>18.0版本
没错 就是这么简单 = =
matplotlib去下面看吧
今天在练习《机器学习实战》--k-近邻算法代码的过程中需要安装 matplotlib模块,但本身电脑里有anaconda ,不太想用,想体验最简单的python,所以用的Shell。
但装anaconda对于pip就有很大问题,导致每次 pip install xxx 的时候都显示 anaconda里的已经存在了
但!!!我Shell用不了啊!!!
pip install --upgrade pip
python -m pip install --upgrade pip
两种都没办法
最后官网找到
pip install pip
于是完美解决
以下试探过程:
看了看还是pip版本太低
尝试了 pip install --upgrade pip 命令
emm...
........
C:\Users\34856\AppData\Local\Programs\Python\Python36\Scripts>pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
2% |▊ | 30kB 8.2kB/s eta 0:02:36Exception:
Traceback (most recent call last):
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 302, in _error_catcher
yield
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 384, in read
data = self._fp.read(amt)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
data = self.__fp.read(amt)
File "c:\users\34856\appdata\local\programs\python\python36\lib\http\client.py", line 449, in read
n = self.readinto(b)
File "c:\users\34856\appdata\local\programs\python\python36\lib\http\client.py", line 493, in readinto
n = self.fp.readinto(b)
File "c:\users\34856\appdata\local\programs\python\python36\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "c:\users\34856\appdata\local\programs\python\python36\lib\ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "c:\users\34856\appdata\local\programs\python\python36\lib\ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "c:\users\34856\appdata\local\programs\python\python36\lib\ssl.py", line 631, in read
v = 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 "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 659, in unpack_http_url
hashes)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 571, in written_chunks
for chunk in chunks:
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\utils\ui.py", line 139, in iter
for x in it:
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 560, in resp_read
decode_content=False):
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 436, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 401, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "c:\users\34856\appdata\local\programs\python\python36\lib\contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\34856\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 307, 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.
You are using pip version 9.0.3, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
还是 不行
于是 用一下黄字的 python -m pip install --upgrade pip
提示 anaconda里已经有了 = =
果然需要 重新官网找地方下载 pip.whl
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pip
然后放到python 的Scripts 文件夹下
然后运行
看到successfully 以为高枕无忧了
GG
最后 只能老老实实去pip官网
然后看到一行代码 = =
没错就是 pip install pip
然后 完美解决 = =