安装后无法访问Python egg

2024-09-29 01:33:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试构建一个egg,并使用easy\u install在virtualenv中安装它

Setup.py位于“autodeploy directory”上方的目录中,如下所示:

#!/usr/bin/env python

try:
    from setuptools import setup, find_packages
except ImportError:
    from distutils.core import setup, find_packages

setup(
    name='autodeploy',
    version='0.1',
    description='autodeployment tool',
    author='abc',
    author_email='a@bc.com',
    url='http://localhost',
    packages=['autodeploy'])

我造了一个蛋:

(venv) deploy $python setup.py bdist_egg
running bdist_egg
running egg_info
writing autodeploy.egg-info/PKG-INFO
writing dependency_links to autodeploy.egg-info/dependency_links.txt
writing top-level names to autodeploy.egg-info/top_level.txt
package init file 'autodeploy/__init__.py' not found (or not a regular file)
reading manifest file 'autodeploy.egg-info/SOURCES.txt'
writing manifest file 'autodeploy.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.13-x86_64/egg
running install_lib
running build_py
warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build/bdist.macosx-10.13-x86_64/egg
creating build/bdist.macosx-10.13-x86_64/egg/EGG-INFO
copying autodeploy.egg-info/PKG-INFO -> build/bdist.macosx-10.13-x86_64/egg/EGG-INFO
copying autodeploy.egg-info/SOURCES.txt -> build/bdist.macosx-10.13-x86_64/egg/EGG-INFO
copying autodeploy.egg-info/dependency_links.txt -> build/bdist.macosx-10.13-x86_64/egg/EGG-INFO
copying autodeploy.egg-info/top_level.txt -> build/bdist.macosx-10.13-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/autodeploy-0.1-py3.6.egg' and adding 'build/bdist.macosx-10.13-x86_64/egg' to it
removing 'build/bdist.macosx-10.13-x86_64/egg' (and everything under it)
(venv) deploy $

否我安装:

(venv) deploy $easy_install dist/autodeploy-0.1-py3.6.egg
Processing autodeploy-0.1-py3.6.egg
Removing /Users/joe/Desktop/deploy/venv/lib/python3.6/site-packages/autodeploy-0.1-py3.6.egg
Copying autodeploy-0.1-py3.6.egg to /Users/joe/Desktop/deploy/venv/lib/python3.6/site-packages
autodeploy 0.1 is already the active version in easy-install.pth

Installed /Users/joe/Desktop/deploy/venv/lib/python3.6/site-packages/autodeploy-0.1-py3.6.egg
Processing dependencies for autodeploy==0.1
Finished processing dependencies for autodeploy==0.1
(venv) deploy $

但是,我无法访问该实用程序-无论是在venv内部还是外部。如果我使用pip列出实用程序,我会看到:

(venv) deploy $pip show autodeploy
Name: autodeploy
Version: 0.1
Summary: autodeployment tool
Home-page: http://localhost
Author: abc
Author-email: a@bc.com
License: UNKNOWN
Location: /Users/joe/Desktop/deploy/venv/lib/python3.6/site-packages/autodeploy-0.1-py3.6.egg
Requires:
Required-by:
(venv) deploy $

Tags: installtobuildinfotxtvenvegglib