최근 작은 프로젝트를 작성하여 Python에 익숙해졌습니다.내 Python 3 패키지 설치 문제
# -*- coding: utf-8 -*-
import re
from setuptools import setup
setup(
name = 'bfi',
packages = ['bfi'],
entry_points = {
'console_scripts' : ['bfi = bfi.bfi:main']
},
version = '1.0',
description = 'Brainf*ck Interpreter w/Shell-Mode',
author = 'Kyle Martinez',
install_requires = ['getch', 'overloading']
)
나는 다음과 같이 명령 줄에서 패키지를 설치하려고 시도 :
python3 setup.py install
작동하는 것 같다 어떤 프로젝트 배포를 만드는 과정에서, 나는이 setup.py
다음 생성! 그러나
running install
running bdist_egg
running egg_info
writing requirements to bfi.egg-info/requires.txt
writing top-level names to bfi.egg-info/top_level.txt
writing bfi.egg-info/PKG-INFO
writing dependency_links to bfi.egg-info/dependency_links.txt
writing entry points to bfi.egg-info/entry_points.txt
reading manifest file 'bfi.egg-info/SOURCES.txt'
writing manifest file 'bfi.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-intel/egg
running install_lib
running build_py
creating build/bdist.macosx-10.6-intel/egg
creating build/bdist.macosx-10.6-intel/egg/bfi
copying build/lib/bfi/__init__.py -> build/bdist.macosx-10.6-intel/egg/bfi
copying build/lib/bfi/__main__.py -> build/bdist.macosx-10.6-intel/egg/bfi
copying build/lib/bfi/bfi.py -> build/bdist.macosx-10.6-intel/egg/bfi
copying build/lib/bfi/bficore.py -> build/bdist.macosx-10.6-intel/egg/bfi
byte-compiling build/bdist.macosx-10.6-intel/egg/bfi/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/bfi/__main__.py to __main__.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/bfi/bfi.py to bfi.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/bfi/bficore.py to bficore.cpython-34.pyc
creating build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying bfi.egg-info/PKG-INFO -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying bfi.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying bfi.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying bfi.egg-info/entry_points.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying bfi.egg-info/requires.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying bfi.egg-info/top_level.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/bfi-1.0-py3.4.egg' and adding 'build/bdist.macosx-10.6-intel/egg' to it
removing 'build/bdist.macosx-10.6-intel/egg' (and everything under it)
Processing bfi-1.0-py3.4.egg
Removing /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/bfi-1.0-py3.4.egg
Copying bfi-1.0-py3.4.egg to /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
bfi 1.0 is already the active version in easy-install.pth
Installing bfi script to /Library/Frameworks/Python.framework/Versions/3.4/bin
Installed /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/bfi-1.0-py3.4.egg
Processing dependencies for bfi==1.0
Searching for overloading==0.5.0
Best match: overloading 0.5.0
Adding overloading 0.5.0 to easy-install.pth file
Using /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Searching for getch==1.0
Best match: getch 1.0
Adding getch 1.0 to easy-install.pth file
Using /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Finished processing dependencies for bfi==1.0
, 내가 명령 줄로 이동 bfi
실행할 때, 나는 큰 '팔자의 구문 에러 얻을 :
Traceback (most recent call last):
File "/usr/local/bin/bfi", line 9, in <module>
load_entry_point('bfi==1.0', 'console_scripts', 'bfi')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", li
ne 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", li
ne 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", li
ne 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/bfi-1.0-py2.7.egg/bfi/bfi.py", line 42
print('➲ ', end='')
^
SyntaxError: invalid syntax
내가 좀 새로 온 사람을 명령을 실행하면 나에게 다음과 같은 출력을 제공합니다 이것 모두에, 그래서 나는 나가 얻을 수있는 어떤 도움든지 감사 할 것입니다! 어떻게 해결할 수 있습니까?
참고 : 추측 했겠지만 내 Macbook에는 여러 버전의 Python이 설치되어 있습니다. 당신은 또한 콘솔 스크립트 BYI를 실행하면 아마 python setup.py install
를 사용하여 python2.7를 사용하여 'BYI'패키지를 설치 한 것처럼
설치할 수 있습니다 다음 - 투 - 마지막 단락에있는 두 개의'print' 문 사이에 아무런 차이가 없습니다. –
작은 차이가 있습니다. 인쇄 후 공간을 참조하십시오. 처음에는 공간 때문에 튜플로 간주됩니다. 두 번째로, 함수 인수로 간주됩니다. – sukrit007
공간이 있다는 것을 알고 있습니다. 제가 말하고자하는 것은 _ 기능상의 차이가 없다는 것입니다. 그 공간은 중요하지 않습니다. 그것은 공간이 그 앞에 오는 지 여부에 관계없이 튜플에 유효한 구문이 아닙니다. –