2

My environment is OSX High Sierra 10.13.6.

➜ python
Python 3.7.2 (default, Jan 13 2019, 12:50:15)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin

➜ python3
Python 3.7.2 (default, Jan 13 2019, 12:50:15)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin

If I entered pip, it throw error.

/usr/local/opt/python/libexec/bin/pip:6: UserWarning: Unbuilt egg for Unknown [unknown version] (/usr/local/lib/python3.7/site-packages)
  from pkg_resources import load_entry_point
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 898, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 789, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 19.0.1 (/usr/local/lib/python3.7/site-packages), Requirement.parse('pip==18.1'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/opt/python/libexec/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3126, in <module>
    @_call_aside
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3110, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 596, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 784, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==18.1' distribution was not found and is required by the application

I tried pip install -U setuptools, But it throw same error.

Also re-installed with get-pip.py, it doesn't work.

Maybe python path is twist in my system.

How can I remove pip and python entirely and reinstalled?

Thanks.

Hide
  • 3,199
  • 7
  • 41
  • 83
  • and you've also tried `python -m pip install --upgrade pip` or `pip install --upgrade pip`? – chickity china chinese chicken Feb 01 '19 at 02:11
  • @davedwards If try to both command, throw error -> `ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (/usr/local/lib/python3.7/site-packages))` – Hide Feb 01 '19 at 02:12
  • maybe try `python3 -c "import site; print(site.getsitepackages())"` and in each directory in the result try `find . -name METADATA` and if found remove the invalid directory. – chickity china chinese chicken Feb 01 '19 at 02:24
  • @davedwards first command result -> `['/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages']`. But there is no METADATA in that directory. – Hide Feb 01 '19 at 02:26
  • have you used `homebrew` or `easy_install` before to install packages? see here: https://stackoverflow.com/a/25276953/1248974 and check where your your `pip` is symlinked to? – chickity china chinese chicken Feb 01 '19 at 02:34

0 Answers0