pip installation throws IOerror - no setup.py

2019-06-05 13:32发布

I'm packaging my project via setup.py of a following structure:

import os
from setuptools import setup

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
    name = "blah",
    version = "0.0.1",
    author = "Chuck Norris",
    author_email = "xyz@gmail.com",
    description = ("blah blah blah."),
    license = "BSD",
    keywords = "django",
    url = "http://packages.python.org/blah",
    packages=['blah'],
    long_description=read('README'),
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Topic :: Utilities",
        "License :: OSI Approved :: BSD License",
    ],
)

My directory structure is

folder/
--blah/__init__.py
--blah/other stuff
--readme
--setup.py 

When installing the .egg with pip, I get error IOError: [Errno 2] No such file or directory: '/tmp/pip-Us23IZ-build/setup.py'.

When unzipped, egg does not contain setup.py, indeed. I'm not sure whether it should, or not, or is it of any relevance to the error at all.

Thanks.

1条回答
ゆ 、 Hurt°
2楼-- · 2019-06-05 13:48

It is likely, you have setup.py in wrong directory.

Proper directory structure is:

projectroot/
  setup.py
  README
  blah/
    __init__.py
    <whatever other modules your package needs>

Packaging (calling the setup.py to build an egg or other distribution package) shall be done from projectroot.

After creation of the egg file, you shall visit it (the egg file is zip archive) and check, if setup.py is present.

查看更多
登录 后发表回答