求教各位:我用的是Python3.8版本,請問應該怎么安裝pygame呢?找不到適用的pygame版本。弄了一下午也沒安裝成功,哪位大神知道的麻煩告訴我,在線急等,萬分感謝。
uj5u.com熱心網友回復:
python -m pip install pygameuj5u.com熱心網友回復:
試過了,不行啊uj5u.com熱心網友回復:
這辦法試了,出錯,安裝不了
uj5u.com熱心網友回復:
提示啥錯誤?uj5u.com熱心網友回復:
提示一大堆
E:\Python\Python38>python -m pip install pygame
Collecting pygame
Using cached https://files.pythonhosted.org/packages/b2/6b/c510f0853765eb2219c
a5aa3d416d65bb0dea7cd9bb2984aea0a0e04c24d/pygame-1.9.4.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "config.py"
Using WINDOWS configuration...
Path for SDL not found.
Too bad that is a requirement! Hand-fix the "Setup"
Path for FONT not found.
Path for IMAGE not found.
Path for MIXER not found.
Path for PNG not found.
Path for JPEG not found.
Path for PORTMIDI not found.
Path for COPYLIB_tiff not found.
Path for COPYLIB_z not found.
Path for COPYLIB_vorbis not found.
Path for COPYLIB_ogg not found.
If you get compiler errors during install, doublecheck
the compiler flags in the "Setup" file.
Continuing With "setup.py"
Error with the "Setup" file,
perhaps make a clean copy from "Setup.in".
---
For help with compilation see:
https://www.pygame.org/wiki/CompileWindows
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-x0vfi4a3\pygame\setup.py:32
1: SyntaxWarning: invalid escape sequence \d
return ', '.join(s for s in findall('\d+', ver)[0:3])
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-x0vfi4a3\pygame\set
up.py", line 203, in <module>
extensions = read_setup_file('Setup')
File "E:\Python\Python38\lib\distutils\extension.py", line 171, in read_se
tup_file
line = expand_makefile_vars(line, vars)
File "E:\Python\Python38\lib\distutils\sysconfig.py", line 405, in expand_
makefile_vars
s = s[0:beg] + vars.get(m.group(1)) + s[end:]
TypeError: can only concatenate str (not "NoneType") to str
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ADMINI~1
\AppData\Local\Temp\pip-install-x0vfi4a3\pygame\
uj5u.com熱心網友回復:
pygame-1.9.4.tar.gz 這個檔案我也下載了,用 pip install pygame.tar.gz來安裝也安不成功uj5u.com熱心網友回復:
看了提示可以這樣試試
解壓 pygame-1.9.4.tar.gz
到 pygame-1.9.4 目錄
python config.py
python setup.py install
如果還是不行, 有可能是對3.8 的支持問題了。
uj5u.com熱心網友回復:
3.8這么新的嗎,這是測驗版吧,最好不要用這么新的版本,用3.6比較穩uj5u.com熱心網友回復:
官網不才更新到3.7.2嗎?沒必要用最新的。剛剛看了最新的pygame為1.9.4支持python3.7,所以肯定安裝不了uj5u.com熱心網友回復:
最新的3.8還不穩定,用3.7uj5u.com熱心網友回復:
有辦法安裝上,更改xml名稱,把37改為38,pip intall xxxxxx,能正確安裝上uj5u.com熱心網友回復:
我前幾天下載的3.8版本,也遇到這個問題,試過各個版本的pygame檔案,安裝都不成功(應該是開發版沒有適配的pygame3.8版本),后來卸載了python3.8,安裝穩定版本的python3.7,在命令視窗輸入pip install pygame==1.9.4就自動安裝成功了。uj5u.com熱心網友回復:
太新了,pygame應該還沒有適配 3.8uj5u.com熱心網友回復:
https://pypi.org/project/pygame/2.0.0.dev6/#files這個網址可以下載uj5u.com熱心網友回復:
需要先升級PIP本身C:\Programs\Python\Python38-32>python -m pip install --upgrade pip
|████████████████████████████████| 1.4MB 47
|████████████████████████████████| 1.4MB 47
|████████████████████████████████| 1.4MB 47
kB/s
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-19.3.1
然后再安裝pygame
C:\Python\Python38-32>python -m pip install
pygame
Collecting pygame
Downloading https://files.pythonhosted.org/packages/d2/ba/8e4f8fae51bd9d5766f1
f20c9ce451e93929ee9efdd2784b1a7b469ea76e/pygame-1.9.6-cp38-cp38-win32.whl (4.4MB
)
|███████████████▌ | 2.1MB 20kB/s eta 0:01:51
|███████████████▌ | 2.1MB 20kB/s eta 0:01:51
|███████████████▌ | 2.2MB 19kB/s eta 0:01:55
|███████████████▌ | 2.2MB 19kB/s eta 0:01:54
。。。。。。
|████████████████████████████████| 4.4MB 22
|████████████████████████████████| 4.4MB 22
|████████████████████████████████| 4.4MB 22
|████████████████████████████████| 4.4MB 23
|████████████████████████████████| 4.4MB 23
kB/s
Installing collected packages: pygame
Successfully installed pygame-1.9.6
uj5u.com熱心網友回復:
pip install pygame=1.9.6uj5u.com熱心網友回復:
3.8的python 安裝好,pygame里面的一些模塊也用不了的。比如mixer模塊,版本對應不上uj5u.com熱心網友回復:
我用pygame.mixer一直顯示未定義,折騰了一周了。翻到你這個文章才反應過來應該是版本不對應導致的。uj5u.com熱心網友回復:
https://blog.csdn.net/qq_43738233/article/details/103950410這篇文章有用,版本、環境、pip升級,少走彎路
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/62268.html
