[英]Syntax Error encountered while installing package in linux terminal
我正在嘗試為 Python 下載 Turtle Graphics Package,因此我在 linux 終端中輸入以下命令:
myusername@penguin:~/Pys$ pip3 install turtle
這是我遇到的錯誤:
Collecting turtle
Using cached https://files.pythonhosted.org/packages/ff/f0/21a42e9e424d24bdd0e509d5ed3c7dfb8f47d962d9c044dba903b0b4a26f/turtle-0.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-c6dr99ga/turtle/setup.py", line 40
except ValueError, ve:
^
SyntaxError: invalid syntax
我嘗試下載的文件中似乎存在語法錯誤。 有沒有辦法解決這個問題?
海龜圖形已經是 Python 標准庫的一部分,你不需要安裝它。
參見: https://docs.python.org/3/library/turtle.html
只需導入它:
import turtle
setup.py 的編寫方式似乎存在問題。
要解決此問題,請運行
pip3 install turtle
Your output will contain a link to the turtle tar.gz file ( https://files.pythonhosted.org/packages/ff/f0/21a42e9e424d24bdd0e509d5ed3c7dfb8f47d962d9c044dba903b0b4a26f/turtle-0.0.2.tar.gz )
運行wget <paste_link_here>
或從鏈接手動下載 tar.gz 文件
使用tar -xvf turtle-0.0.2.tar.gz
提取文件夾
go 進入海龜目錄並在任何文本編輯器中打開 setup.py。
在第 40 行,更改
`except ValueError, ve:`
至
except ValueError as ve:
然后再次將文件夾壓縮為 tar 文件,然后在本地文件上運行 pip3 install
pip3 install turtle-0.0.2.tar.xz
這應該可以解決 package 的問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.