0

I am new to python, just installed python 3.8.2 and using pycharm to try programming

I guess there is sth wrong with my pip which always direct to the directory of python 2.7 and I tried to alias to the new version, which seems fine, but when I install pygame using pip, it still saves in folders under python 2.7

which python

python: aliased to /usr/local/bin/python3.8

which pip

pip: aliased to /usr/local/bin/pip3.8

when I try

pip install pygame

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pygame in ./Library/Python/2.7/lib/python/site-packages (2.0.0.dev6)
Tom Carrick
  • 6,349
  • 13
  • 54
  • 78
LTChan
  • 1
  • 4
  • `python3.8 -m pip install pygame==2.0.0.dev6` I can install pygame version but unable to import, – LTChan May 02 '20 at 09:44
  • when i try `python3.8 -m pip3 install pygame==2.0.0.dev6`, it said "No module named pip3", it there any problem with my pip on python 3.8? – LTChan May 02 '20 at 09:46

1 Answers1

2

Use pip3 install pygame. You can install python 3.x.x modules by using pip3.

I am sure that pygame does not support python 3.8.x so you will get an error, try installing it in a python 3.6.x enviroment.

EthernalHusky
  • 485
  • 7
  • 19
  • Thank you, i have tried but it show `Requirement already satisfied: pygame in /usr/local/lib/python3.7/site-packages (1.9.6)` – LTChan May 02 '20 at 09:22
  • So it is installed in python 3.7? but i cant import it in pycharm, "ModuleNotFoundError: No module named 'pygame'" – LTChan May 02 '20 at 09:27
  • 1
    if you want to install a package in a specified python3 version use `python3.8 -m pip3 install some_module`. But pygame is not compatible with *3.8.2*. You have already it in *3.7*. – EthernalHusky May 02 '20 at 09:31
  • "try installing it in a python 3.6.x enviroment." so i need to install python 3.6? i can only choose python 3.8 as interpretor, even i use python 2 as interpretor in pycharm, i cant import pygame – LTChan May 02 '20 at 09:35
  • Try to install python 3.6.x in your machine, and then in pycharm go to `settings > python interpreter` select python 3.6. If you do not see python 3.6 then add a new base interpreter that that python version usually lies in `/usr/bin/python3.6` – EthernalHusky May 02 '20 at 09:47
  • mark my solution as solved please, it will help me. – EthernalHusky May 02 '20 at 10:02