pip安装会引发IOerror-没有setup.py [英] pip installation throws IOerror - no setup.py

查看:99
本文介绍了pip安装会引发IOerror-没有setup.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过具有以下结构的setup.py打包我的项目:

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",
    ],
)

我的目录结构是

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

使用pip安装.egg时,出现错误IOError: [Errno 2] No such file or directory: '/tmp/pip-Us23IZ-build/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'.

解压缩后,egg实际上不包含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.

谢谢.

推荐答案

很可能您在错误的目录中有setup.py.

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

正确的目录结构是:

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

包装(调用setup.py来构建鸡蛋或其他分发包)应从projectroot完成.

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

在创建egg文件之后,您将访问它(egg文件是zip存档),并检查是否存在setup.py.

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

这篇关于pip安装会引发IOerror-没有setup.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆