Python command is not working in terminal

时间:2018-03-22 23:40:53

标签: python-3.x command-line terminal

I've downloaded Python about a year ago, and back then, I had trouble executing files from the terminal. So, being ye of little faith, I quit trying and forgot most of my Python knowledge. Now, I' revisiting Python, and it still doesn't work (I updated Python. And deleted it. And updated again) But it still does not work. I made sure I'm in the directory that Python is supposedly in. Please help.

2 个答案:

答案 0 :(得分:1)

Make sure you already configure python's directory path in system settings. For windows :

Computer properties > Advanced System Settings > Environment Variables > Set your path

You should see something like this:

enter image description here

If you don't see python in the Environment Variables, just:

  1. Click New
  2. Then click "Browse"
  3. Navigate the menu until you find the Python directory
  4. Select it and click Ok

Close all the windows and restart whatever applications you wanted to be aware of the python path.

Additionally, if you're already in an elevated command prompt you can set the path using the command prompt as you can read about in this other StackOverflow post.

答案 1 :(得分:0)

更容易

再次启动Python的安装程序,然后单击“修改”。 在“高级选项”中,选中“将Python添加到环境变量”