最新消息:20181230 VPS服务器已从Linode换到腾讯云香港,主题仍用朋友推荐的大前端D8

【已解决】Mac中升级Python 3的pipenv的版本

Mac crifan 110浏览 0评论

折腾:

【已解决】pipenv install PySpider卡死在:Locking [packages] dependencies

需要去升级最新版本的pipenv

当前是:

<code>➜  crawler_x pipenv --version
pipenv, version 11.10.0
</code>

此处pipenv版本是11.10.0

https://github.com/pypa/pipenv

好像有更新版本:v2018.7.1

所以要去升级,以便于看看能否解决卡死的问题。

而此处Mac中,之前貌似是安装了两套Python 2和Python 3的pipenv的

而此处用的好像是python 3的pipenv

<code>➜  crawler_x which pipenv
/Users/crifan/Library/Python/3.6/bin/pipenv
</code>

根据自己之前的记录:

【已解决】Mac本地安装Python3的pipenv虚拟环境

找到之前是通过:

<code>pip3 install pipenv --user
</code>

安装的python3,pip3的pipenv

那估计升级就是:

<code>pip3 upgrade pipenv --user
</code>

不过先去看看help

<code>➜  crawler_x pip3 --help

Usage:
  pip3 &lt;command&gt; [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING,
                              ERROR, and CRITICAL logging levels).
  --log &lt;path&gt;                Path to a verbose appending log.
  --proxy &lt;proxy&gt;             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries &lt;retries&gt;         Maximum number of retries each connection should attempt (default 5 times).
  --timeout &lt;sec&gt;             Set the socket timeout (default 15 seconds).
  --exists-action &lt;action&gt;    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort).
  --trusted-host &lt;hostname&gt;   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert &lt;path&gt;               Path to alternate CA bundle.
  --client-cert &lt;path&gt;        Path to SSL client certificate, a single file containing the private key and the certificate in
                              PEM format.
  --cache-dir &lt;dir&gt;           Store the cache data in &lt;dir&gt;.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output
</code>

好像没有upgrade

通过:

【已解决】Mac中把Python3的pip重新换成Python2的pip

python3 -m pip install –upgrade –force-reinstall pip

好像升级是:

pip install –upgrade

所以去:

<code>pip3 install --upgrade pipenv --user
</code>

结果网络超时了:

<code>➜  crawler_xx pip3 install --upgrade pipenv --user
Collecting pipenv
  Downloading https://files.pythonhosted.org/packages/eb/64/9b2747d54f2008ac3dfe86c0b1c8ec126042726fd8a540d5208d26732701/pipenv-2018.7.1-py3-none-any.whl (5.0MB)
    67% |█████████████████████▊          | 3.4MB 11kB/s eta 0:02:23Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 302, in _error_catcher
    yield
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 384, in read
    data = self._fp.read(amt)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 449, in read
    n = self.readinto(b)
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/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 "/usr/local/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 310, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 837, in unpack_url
    progress_bar=progress_bar
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 674, in unpack_http_url
    progress_bar)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 898, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 618, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/utils/hashes.py", line 48, in check_against_chunks
    for chunk in chunks:
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 586, in written_chunks
    for chunk in chunks:
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/utils/ui.py", line 159, in iter
    for x in it:
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 575, in resp_read
    decode_content=False):
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 436, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/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.
</code>

再去试试

ss全局翻墙,看看效果

速度貌似不错:

pip upgrade pipenv

Make more clear that you need to update pip to use pipenv · Issue #803 · pypa/pipenv

Pipenv: Python Dev Workflow for Humans — pipenv 2018.7.1 documentation

Basic Usage of Pipenv — pipenv 2018.7.1 documentation

[翻译] Pipenv – 官方推荐的 Python 包管理工具 – 掘金

果然是:

<code>pip install --user --upgrade pipenv
</code>

然后终于升级完毕了:

<code>➜  crawler_x  pip3 install --upgrade pipenv --user
Collecting pipenv
  Downloading https://files.pythonhosted.org/packages/eb/64/9b2747d54f2008ac3dfe86c0b1c8ec126042726fd8a540d5208d26732701/pipenv-2018.7.1-py3-none-any.whl (5.0MB)
    100% |████████████████████████████████| 5.0MB 58kB/s
Requirement not upgraded as not directly required: virtualenv-clone&gt;=0.2.5 in /Users/crifan/Library/Python/3.6/lib/python/site-packages (from pipenv) (0.3.0)
Requirement not upgraded as not directly required: setuptools&gt;=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv) (38.5.2)
Requirement not upgraded as not directly required: certifi in /Users/crifan/Library/Python/3.6/lib/python/site-packages (from pipenv) (2018.4.16)
Requirement not upgraded as not directly required: pip&gt;=9.0.1 in /usr/local/lib/python3.6/site-packages (from pipenv) (10.0.1)
Requirement not upgraded as not directly required: virtualenv in /Users/crifan/Library/Python/3.6/lib/python/site-packages (from pipenv) (15.2.0)
Installing collected packages: pipenv
  Found existing installation: pipenv 11.10.0
    Uninstalling pipenv-11.10.0:
      Successfully uninstalled pipenv-11.10.0
Successfully installed pipenv-2018.7.1
➜  crawler_x which pipenv
/Users/crifan/Library/Python/3.6/bin/pipenv
➜  crawler_x pipenv --version
pipenv, version 2018.7.1
</code>

【总结】

之前是用:

<code>pip3 install pipenv --user
</code>

在Mac中使用pip3安装的Python 3的pipenv

然后此处想要升级pipenv,则是:

<code>pip3 install --upgrade pipenv --user
</code>

其中如果遇到网络太慢或超时,则使用(ss)的全局翻墙去加速即可。

转载请注明:在路上 » 【已解决】Mac中升级Python 3的pipenv的版本

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
57 queries in 0.080 seconds, using 10.04MB memory