简体   繁体   中英

Python Packaging on Linux with many Imports using disutils' setup.py

I want to have my python program installed on linux computers (and later windows if someone can help me with that). Ideally this would work on anyone's computer who has python installed, but not all the required modules. I am thinking of this like a C binary/executable after running gcc / make commands.

The hard part is that I don't understand how to handle all the imports required. I keep failing when using py2exe or similiar things because I am using 'GDAL'. So here is what I want to put in my setup.py, but I am so confused. Any help greatly appreciated.

setup.py:

from disutils.core import setup

setup(
  name='gui',
  version='1.0',
  py_modules=['gui'],
  install_requires=[],
)

My main files is "gui.py". When I run ipython and then run gui.py my program executes perfectly.

Here are the import statements from the gui.py and the files it includes for reference:

gui.py:

#!/usr/bin/env python

from Tkinter import *
import tkFileDialog
from scipy import *
import spleem_image_class as sic
import spleem_image_display_class as sidc
import matplotlib.pyplot as plt
// code ...

spleem_image_class.py:

# -*- coding: iso-8859-15 -*-

from osgeo import gdal
import scipy
import scipy.interpolate
import itertools
from scipy import ndimage
from scipy.ndimage import morphology
from scipy import math
from scipy import *
import matplotlib.pyplot as plt
from scipy import linalg
// code ...

spleem_image_display_class.py

#!/usr/bin/env python
# -*- coding: iso-8559-15 -*-

import matplotlib.pyplot as plt
import matplotlib.colors
import matplotlib.cm as cm
import colorsys
import scipy.optimize as optimize
from scipy import *
import scipy
import numpy
import sys
import itertools
import spleem_image_class as SI
import pickle
// code ...

根据distutils文档,看起来在setup()您需要类似以下内容: packages=['distutils', 'distutils.command'],

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