简体   繁体   中英

Python setup.py install failed

I have a simple dir structure

gpp/
   .. a.py
   .. setup.py

and in setup.py

import os
from setuptools import setup

version = '0.1.0'

setup(
    name = 'gpp',
    version = version,
    py_modules = ['a'],
    )

then I try to install this in my own machine by

python setup.py install

the egg show up in the correct location, I am using anaconda and virtual env of anaconda, so ~/anaconda/envs/palladium-gp/lib/python3.4/site-packages

but it is only in egg

gpp-0.1.0-py3.4.egg

unzip , and import fails

python
import gpp

failed

The directory structure should be:

gpp/
   .. __init__.py
   .. a.py
setup.py

and you would need to specify the package:

setup(
    name = 'gpp',
    version = version,
    packages=['gpp', 'gpp.a'],
)

You can then import:

from gpp import a

or:

import gpp.a

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM