# Manually removed Python, HELP

**URL:** <https://discuss.python.org/t/manually-removed-python-help/6301>\
**Category:** Python Help\
**Created:** [December 22, 2020, 2:21pm UTC](https://discuss.python.org/t/manually-removed-python-help/6301 "2020-12-22T14:21:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvb06](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@jvb06](https://discuss.python.org/u/jvb06)\
**Post date:** [December 22, 2020, 2:21pm UTC](https://discuss.python.org/t/manually-removed-python-help/6301/1 "2020-12-22T14:21:22Z")

</div>

Hi, please help me I’m already stuck on this 2 days.

Ok it is as follows: I have a MacBookPro 2019, I deleted everything what has to do with Python on my computer via downloads and then searching on python. I am afraid I deleted the standard version of Python which comes automatically on your Mac. Now, I cannot install pip and Python again. Someone has tips on how to solve. ‘python --version’ gives me a message ; ‘Python is not defined’ and ‘python -m pip install -U pip’ gives me an invalid syntax. ‘Pip install pandas’ gives me also an invalid syntax. How to solve this and fix my python ☹ ??? Thanks if you could help.

---

<div class="post-metadata">

**Author:** ![steven.daprano](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steven.daprano/32/1083_2.png) [@steven.daprano](https://discuss.python.org/u/steven.daprano)\
**Post date:** [December 22, 2020, 8:56pm UTC](https://discuss.python.org/t/manually-removed-python-help/6301/2 "2020-12-22T20:56:49Z")

</div>

Don’t Macs automatically run backups of your system? Something called  
Time Machine, I think?

Can you restore the lost Python files from Time Machine, and then be  
more careful about only deleting your installed Python, and not the  
system Python.

Otherwise, can you run the Mac installer and re-install the missing  
Python packages? Or is there a system repair tool you can use?

You may have to ask Mac specialists how to fix this.

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [December 23, 2020, 1:36am UTC](https://discuss.python.org/t/manually-removed-python-help/6301/3 "2020-12-23T01:36:05Z")

</div>

From the error message, it looks like you are typing `python --version` and `pip install -U pip` at the Python prompt, and not at the system command prompt.  
Let me explain a bit. (Apologies if you already knew, it’s hard to judge that.)

The system prompt, which usually ends with a `$`, is used to run commands like `python --version` or `python -m pip`:

```nohighlight
$ python --version
Python 3.9.1
$ python -m pip install -U pip
Requirement already satisfied: pip in .../site-packages (19.3.1)

```

If you run just `python`, without arguments, you’ll enter Python’s interactive mode (REPL), where the prompt changes to `>>>` and where you can enter Python commands, but _not_ the system commands:

```nohighlight
$ python
Python 3.9.1 (default, Dec 8 2020, 00:00:00) 
[GCC 10.2.1 20201016 (Red Hat 10.2.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 + 1
2
>>> python --version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined

```

The way back is to call [`exit()`](https://docs.python.org/3/library/constants.html?highlight=exit#exit), which will exit the REPL and put you back to the system command prompt:

```nohighlight
>>> exit()
$

```

It’s also possible that you’re starting Python directly, and `exit()` will close the window instead of take you to the system command prompt. In that case, you need to use the system command prompt instead. (I hear it’s under Applications → Utilities → Terminal, but I’m not personally familiar with Mac.)

---

<div class="post-metadata">

**Author:** ![jvb06](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@jvb06](https://discuss.python.org/u/jvb06)\
**Post date:** [December 23, 2020, 9:32am UTC](https://discuss.python.org/t/manually-removed-python-help/6301/4 "2020-12-23T09:32:19Z")

</div>

Thank you all! I managed to fix it. I restarted my Mac to Factory Settings and then Python 2.7 was again present. Thanks a lot for ypur thinking and responses and happy christmas.
