简体   繁体   中英

“SyntaxError” when installing Python package with pip

I want to make a game that creates a random word for the player to find. The code below does this, but I'm looking for a better way to generate the random words.

l1=["THIS IS A","THIS IS B","THIS IS C"]
import random
name=random.choice(l1)
print(name)

After a few days, I've learned about the "Random-Word" library. After even more study, I found out the command: pip install Random-Word . So I copied and pasted it into the terminal. I got the following error:

SyntaxError: invalid syntax

How can I fix this? Thanks for the help.

I want to make a game that creates a random word for the player to find. The code below does this, but I'm looking for a better way to generate the random words.

l1=["THIS IS A","THIS IS B","THIS IS C"]
import random
name=random.choice(l1)
print(name)

After a few days, I've learned about the "Random-Word" library. After even more study, I found out the command: pip install Random-Word . So I copied and pasted it into the terminal. I got the following error:

SyntaxError: invalid syntax

How can I fix this? Thanks for the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM