setup.py
ファイルを作成しました。でも配布の仕方がわからない?
この本には、ターミナル ウィンドウを開き、次の 1 つのコマンドを入力すると書かれていますpython3 setup.py sdist
。私はそれをしましたが、常にエラーが発生します!
本の例にすぎないので、コードは問題ないと思います。エラーは、ディストリビューションのビルド方法によるものだと思います。
Pythonコマンドライン端末で、ディレクトリを変更するには?
ファイルのコードはnester.py
次のようになります。
def print_lol(the_list):
for each_item in the_list:
if isinstance(each_item, list):
print_lol(each_item)
else:
print(each_item)
setup.py
ファイルは次のとおりです。
from distutils.core import setup
setup(
name = 'nester',
version = '1.0.0',
py_modules = ['nester'],
author = 'hfpython',
author_email = 'hfpython@headfirstlabs.com',
url = 'http://www.headfirstlabs.com',
description = 'A simple printer of nested lists',
)
入力したコマンドは次のとおりです。python3 setup.py sdist
次に、エラーが発生します。
File "<stdin>",line 1
pythons setup.py sdist
syntaxError: invalid syntax