我的应用程序以.egg文件的形式发布。用户使用easy_install
成功安装eggitems = []
items.append("hello\nworld")
for i in items:
print(i)
不幸的是,卸载失败了:
$ sudo easy_install abcdef-1.0.0-py2.7.egg
控制台脚本仍然存在于/ usr / local / bin /
中$ sudo pip uninstall abcdef
Uninstalling abcdef-1.0.0:
/usr/local/lib/python2.7/dist-packages/abcdef-1.0.0-py2.7.egg
Proceed (y/n)? y
Successfully uninstalled abcdef-1.0.0
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 252, in main
pip_version_check(session)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/outdated.py", line 102, in pip_version_check
installed_version = get_installed_version("pip")
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 838, in get_installed_version
working_set = pkg_resources.WorkingSet()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 644, in __init__
self.add_entry(entry)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 700, in add_entry
for dist in find_distributions(entry, True):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1949, in find_eggs_in_zip
if metadata.has_metadata('PKG-INFO'):
File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/abcdef-1.0.0-py2.7.egg'
这是我的setup.py
$ abcdef
Traceback (most recent call last):
File "/usr/local/bin/abcdef", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'abcdef==1.0.0' distribution was not found and is required by the application
如何解决? setup.py中缺少任何内容?
from setuptools import setup
setup(
name='abcdef',
version='1.0.0',
packages=['abcdef'],
entry_points={
'console_scripts': [
'abcdef = abcdef.abcdef:main',
],
},
)