-1

I have created the setup.py file. But I don't know how to make a distribution?

The book said that Open a terminal window and type a single command: python3 setup.py sdist. I did that but always get error!

I feel the code is ok, because it is just the example in the book. I guess the error is from the way I build the distribution.

In the python command line terminal, how to change directory?

The code of file nester.py goes like following:

def print_lol(the_list):
for each_item in the_list:
  if isinstance(each_item, list):
    print_lol(each_item)
  else:
    print(each_item)

The setup.py file is as following:

from distutils.core import setup
setup(
  name = 'nester',
  version = '1.0.0',
  py_modules = ['nester'],
  author = 'hfpython',
  author_email = '[email protected]',
  url = 'http://www.headfirstlabs.com',
  description = 'A simple printer of nested lists',
)

And the command I type in is: python3 setup.py sdist then I get the error:

File "<stdin>",line 1
  pythons setup.py sdist
syntaxError: invalid syntax
1

3 Answers 3

1

In the python command line terminal, how to change directory?

Irrelevant, since this isn't supposed to be entered into the Python REPL. Enter it into the shell/command prompt instead.

0

Make sure you add the path if Python is not installed in your c drive, and add the Python file name correctly (the python file is named automatically according to its version while installed). Also make sure the setup.py file is inside the Python file.

For example, I installed my python in e drive and the version is 3.4.2. The file name created automatically for it is Python34.

in the command line, I typed:

e:\Python34\setup.py sdist

Hope this help.

Joey

0

Since you are on windows, so depending upon the python version & install location of python

use command as like. First you must be clear of the path to python.

C:\python33\python setup.py sdist

I hope this helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.