pip installation throws IOerror - no setup.py

岁酱吖の 提交于 2019-12-23 01:01:33

问题


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:


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.



来源:https://stackoverflow.com/questions/27815146/pip-installation-throws-ioerror-no-setup-py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!