Python 模块不会安装

标签 python setuptools distutils

这是我的setup.py 文件

#!/usr/bin/env python

from setuptools import setup
from sys import path

setup(name= 'conundrum',
    version= '0.1.0',
    author= 'elssar',
    author_email= 'elssar@altrawcode.com',
    py_modules= ['conundrum'],
    url= 'https://github.com/elssar/conundrum',
    license= 'MIT',
    description= 'A framework agnostic blog generator.',
    long_description= open(path[0]+'/README.md', 'r').read(),
    install_requires= [
        'PyYAML >= 3.0.9',
        'Markdown >= 2.2.0',
        'requests >= 1.0.4',
        ],
)

我尝试过同时使用 setuptoolsdistutils,但这不会安装我的模块。相反,我得到了

file module.py (for module module) not found

这是我的目录结构

/module
|--/test
|--README.md
|--license.txt
|--module.py
|--setup.py

明确一点,模块是根目录。

谁能告诉我我做错了什么?

这是我尝试安装时的输出

elssar@elssar-laptop:/usr/local/src/conundrum$ sudo python /home/elssar/code/conundrum/setup.py install
/usr/lib/python2.6/distutils/dist.py:250: UserWarning: 'licence' distribution option is deprecated; use 'license'
  warnings.warn(msg)
running install
running bdist_egg
running egg_info
writing requirements to conundrum.egg-info/requires.txt
writing conundrum.egg-info/PKG-INFO
writing top-level names to conundrum.egg-info/top_level.txt
writing dependency_links to conundrum.egg-info/dependency_links.txt
warning: manifest_maker: standard file 'setup.py' not found
file conundrum.py (for module conundrum) not found
reading manifest file 'conundrum.egg-info/SOURCES.txt'
writing manifest file 'conundrum.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
file conundrum.py (for module conundrum) not found
file conundrum.py (for module conundrum) not found
warning: install_lib: 'build/lib.linux-x86_64-2.6' does not exist -- no Python modules to install
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying conundrum.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying conundrum.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying conundrum.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying conundrum.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying conundrum.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/conundrum-0.1.0-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing conundrum-0.1.0-py2.6.egg
removing '/usr/local/lib/python2.6/dist-packages/conundrum-0.1.0-py2.6.egg' (and everything under it)
creating /usr/local/lib/python2.6/dist-packages/conundrum-0.1.0-py2.6.egg
Extracting conundrum-0.1.0-py2.6.egg to /usr/local/lib/python2.6/dist-packages
conundrum 0.1.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.6/dist-packages/conundrum-0.1.0-py2.6.egg
Processing dependencies for conundrum==0.1.0
Searching for requests==1.0.4
Best match: requests 1.0.4
Adding requests 1.0.4 to easy-install.pth file

Using /usr/local/lib/python2.6/dist-packages
Searching for Markdown==2.2.0
Best match: Markdown 2.2.0
Processing Markdown-2.2.0-py2.6.egg
Markdown 2.2.0 is already the active version in easy-install.pth
Installing markdown_py script to /usr/local/bin

Using /usr/local/lib/python2.6/dist-packages/Markdown-2.2.0-py2.6.egg
Searching for PyYAML==3.10
Best match: PyYAML 3.10
Adding PyYAML 3.10 to easy-install.pth file

Using /usr/local/lib/python2.6/dist-packages
Finished processing dependencies for conundrum==0.1.0

为了确保我的系统没有问题,我从 github 下载了两个具有类似 setup.py 的软件包并安装了它们。安装没有任何问题。

最佳答案

我无法从不同的目录运行 setup.py。它需要从它所在的目录运行。这就是这里的问题。

已修复。

关于Python 模块不会安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14865990/

相关文章:

python - 使用 Python Egg/Wheel 打包共享对象(库)

python - 在 python3.x 中标记化

python - 如何让游戏中的零食以随机颜色出现?

Python白痴时刻: string indices must be integers,不是str

python - `python setup.py sdist` 与 cython 扩展 : . pyx ' doesn' t 匹配任何文件

python - 将 Python 二进制模块安装到 Windows 中的自定义位置

python - 如何在 PyPi 中的某个根包下组织我的包?

python - 由于 PyGame 错误需要帮助

python - python 一次进行更多迭代

Python:为什么 pip install 不从 sdist 部署我的代码?