[英]Python - Zero length field name in format
我在我的Centos機器上使用Python,當我嘗試運行我的程序時,我顯示了以下錯誤:
Running setup.py egg_info for package pyepr
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/pyepr/setup.py", line 68, in <module>
print('using EPR C API sources at "{}"'.format(eprsrcdir))
ValueError: zero length field name in format
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/pyepr/setup.py", line 68, in <module>
print('using EPR C API sources at "{}"'.format(eprsrcdir))
ValueError: zero length field name in format
我已經檢查了關於這個主題的其他問題,我已經安裝了Python 2.7.6並將其設置為我的默認配置,如下所示....
$ python -V
Python 2.7.6
肯定有什么問題,但我不知道是什么。
有人有想法嗎?
謝謝
如果您使用Python 2.6或更早版本運行該代碼,則只能引發該錯誤。 在這些版本中,您必須顯式編號為str.format
的格式字段(從0
開始):
print('using EPR C API sources at "{0}"'.format(eprsrcdir))
當然,這只是一個臨時修復。 最好先調查一下為什么你的代碼沒有用Python 2.7運行然后修復它。
如果使用sudo運行安裝,那么最終將使用sudo路徑的Python解釋器。 不確定您是否使用sudo進行安裝,但您很有可能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.