我已经安装了两个版本的pip的venv,如何删除其中一个? Venv默认使用10.0.1,但是当我尝试运行时
python -m pip install --upgrade pip
我得到:
Requirement already up-to-date: pip in c:\users\<username>\pycharmprojects\convertshapefile\venv\lib\site-packages (18.0)
来自<project>\venv\Lib\site-packages
的ls:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 03.08.2018 14:36 pip
d----- 02.08.2018 16:58 pip-10.0.1-py3.7.egg
d----- 03.08.2018 14:36 pip-18.0.dist-info
d----- 02.08.2018 16:59 pyshp-1.2.12.dist-info
d----- 02.08.2018 16:59 __pycache__
-a---- 03.08.2018 14:36 31 easy-install.pth
-a---- 02.08.2018 16:58 563215 setuptools-39.1.0-py3.7.egg
-a---- 02.08.2018 16:58 31 setuptools.pth
-a---- 02.08.2018 16:59 52285 shapefile.py
编辑:
将pip-10.0.1-py3.7.egg重命名为pip-10.0.1-py3.7.egg_xxx之后,我得到了
(venv) PS C:\Users\<username>\PycharmProjects\ConvertShapefile> pip
Traceback (most recent call last):
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 574, in _build_master
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 892, in require
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 783, in resolve
pkg_resources.VersionConflict: (pip 18.0 (c:\users\<username>\pycharmprojects\convertshapefile\venv\lib\site-packages), Requirement.parse('pip==10.0.1'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\Scripts\pip-script.py", line 6, in <module>
from pkg_resources import load_entry_point
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 3086, in <module>
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 3070, in _call_aside
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 3099, in _initialize_master_working_set
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 576, in _build_master
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 589, in _build_from_requirements
File "C:\Users\<username>\PycharmProjects\ConvertShapefile\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\pkg_resources\__init__.py", line 778, in resolve
pkg_resources.DistributionNotFound: The 'pip==10.0.1' distribution was not found and is required by the application
答案 0 :(得分:0)
尝试将pip-10.0.1-py3.7.egg
重命名为pip-10.0.1-py3.7.egg_nope
。
如果这使您的Python使用18.x,则可以安全地删除现在重命名的.egg文件。