无法卸载pycrypto:找不到pycrypto-2.6-py2.7-win32.egg

时间:2017-11-27 03:28:27

标签: python python-2.7 import

我正在安装pycrypto,并且不小心并安装了win32版本。不幸的是,当我去卸载它时,它找不到指定的文件(下面的完整错误)。谢谢你的帮助。

Uninstalling pycrypto-2.6:
c:\python27\lib\site-packages\pycrypto-2.6-py2.7-win32.egg
Proceed (y/n)? y
Successfully uninstalled pycrypto-2.6
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\pip\__init__.py", line 233, in main
return command.main(cmd_args)
File "c:\python27\lib\site-packages\pip\basecommand.py", line 252, in main
pip_version_check(session)
File "c:\python27\lib\site-packages\pip\utils\outdated.py", line 102, in 
pip_version_check
installed_version = get_installed_version("pip")
File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 838, in 
get_installed_version
working_set = pkg_resources.WorkingSet()
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", 
line 644, in __init__
self.add_entry(entry)
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", 
line 700, in add_entry
for dist in find_distributions(entry, True):
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", 
line 1949, in find_eggs_in_zip
if metadata.has_metadata('PKG-INFO'):
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", 
line 1463, in has_metadata
return self.egg_info and self._has(self._fn(self.egg_info, name))
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", 
line 1823, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", 
line 1703, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", 
line 1643, in load
mtime = os.stat(path).st_mtime
WindowsError: [Error 2] The system cannot find the file specified: 
'c:\\python27\\lib\\site-packages\\pycrypto-2.6-py2.7-win32.egg'

1 个答案:

答案 0 :(得分:0)

输出的关键部分是:

Uninstalling pycrypto-2.6:
c:\python27\lib\site-packages\pycrypto-2.6-py2.7-win32.egg
Proceed (y/n)? y

通常,这里有很长的文件列表。在您的情况下,它只是.egg。这意味着您将软件包安装为打包.egg(因此很可能是您使用easy_install而不是pip安装软件包:pip始终解压缩.egg s )。

现在,

WindowsError: [Error 2] The system cannot find the file specified: 
'c:\\python27\\lib\\site-packages\\pycrypto-2.6-py2.7-win32.egg'

表示.egg已被删除(可能是您手动删除了它,或者之前的卸载过程被中断了),但安装元数据却没有。 IIRC它保存在名为pycrypto-2.6-py2.7-win32.egg-info的文件或目录中。

因此,请在site-packages中找到并删除它。