0

This question seems almost too trivial to need to ask, but I can't find any resources that spell it out for me:

I am trying to import a SINGLE .py (named ExpData.py) file into a machine's .../python2.7/site-packages directory, using a setup.py file. Here is the setup.py file:

from setuptools import setup 

setup(name='ExpData',
  py_modules=['ExpData'],
  )

ExpData.py is in the same directory as the setup.py file. To the best of my understanding, executing

python setup.py install

should place the file into the site-packages directory like I want it to, but when I look in the directory after the install, the only ExpDat file is called ExpData-0.0.0-py2.7.egg.

This python install is inside of a conda package installation, and I am trying to execute the

python setup.py install 

command inside of the conda recipe's build.sh file. I suspect this has something to do with the problem, but I don't know any other way of executing the python setup install. Any and all advice is appreciated.

2
  • You need at least an __init__.py file to indicate to Python that this is a package. Also, I'd recommend putting the python script to be installed into its own directory with the same name as the package. See here for a sample directory structure: github.com/pypa/sampleproject
    – darthbith
    Jun 16, 2017 at 17:00
  • Thank you very much! I did some googling around on the init.py file and I think I have a better understanding of how to proceed. I appreciate the response!
    – hsnoop2
    Jun 18, 2017 at 19:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.