Running the following command gives me the following error:
pip install pygame
Error Stack:
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 171, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Python34\lib\site-packages\pip\__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: No module named 'typing'
Introduced since Python 3.5, Python's typing module attempts to provide a way of hinting types to help static type checkers and linters accurately predict errors.
PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
Running this line in a Mac terminal fixed it for me:
/usr/local/opt/[email protected]/bin/python3.9 -m pip install --upgrade pip
I had the same issue. I also first tried the pip3 install pygame
which was previously mentioned, before running this line. You may have to do that first. For the individual who said to try
pip install typing
that line of code will simply produce the same error. To fix it, you have to use to the aforementioned command(s).
I also ran into the same problem, because I made the foolish mistake of upgrading pip as suggested by Python.
I fixed this by downloading get_pip.py
for python3.4 at https://bootstrap.pypa.io/pip/3.4/get-pip.py and running it:
python get_pip.py
It will automatically download the latest compatible version of pip (19.1.1 in this case).
Try to:
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
Do the following:
sudo apt update
sudo apt-get upgrade
If there is a problem, do:
sudo apt --fix-broken install
sudo apt-get upgrade
If there is still a problem, remove and recreate your venv. And Reinstall your requirements:
rm -rf venv
python3.9 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
I encountered the same error on Ubuntu 20.04 when using python3.9
, I tried to run sudo apt update && sudo apt upgrade
.
The output advised me to run sudo apt --fix-broken install
, which had solved my problem and python3.9
is running fine now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With