我如何在未连接互联网的计算机上安装 pygame?
How can i install pygame on my internet not connected computer?
我正在尝试在未连接到互联网的计算机上安装 pygame 程序包。
(环境: windows10, python 3.9(蟒蛇))
所以我从 www.pypi.org 下载了一个“pygame-2.1.2.tar”文件,然后尝试安装它
从 cmd 使用“python setup.py 安装”推荐。
然后它会显示如下错误信息
===============================================================================
(base) C:\pythonpackage\pygame-2.1.2>python setup.py install
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Making dir :prebuilt_downloads:
Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.18-VC.zip
d561079ec622b0bab5a9e02976f5d540b0622da
---
For help with compilation see:
https://www.pygame.org/wiki/CompileWindows
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 174, in
_new_conn
conn = connection.create_connection(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 73,
in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\ProgramData\Anaconda3\lib\socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11002] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 699,
in urlopen
httplib_response = self._make_request(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 382,
in _make_request
self._validate_conn(conn)
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 1010,
in _validate_conn
conn.connect()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 358, in
connect
conn = self._new_conn()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 186, in
_new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at
0x00000237AF075250>: Failed to establish a new connection: [Errno 11002] getaddrinfo
failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 439, in
send
resp = conn.urlopen(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 755,
in urlopen
retries = retries.increment(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 574, in
increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.libsdl.org', port=443):
Max retries exceeded with url: /release/SDL2-devel-2.0.18-VC.zip (Caused by
NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000237AF075250>:
Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\pythonpackage\pygame-2.1.2\setup.py", line 359, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\config.py", line 225, in main
deps = CFG.main(**kwds)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\config_win.py", line 497, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 290, in
ask
update(x86=x86, x64=x64)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 273, in
update
download_prebuilts(download_dir, x86=x86, x64=x64)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 124, in
download_prebuilts
download_sha1_unzip(url, checksum, temp_dir, 1)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 47, in
download_sha1_unzip
response = requests.get(url)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 542, in
request
resp = self.send(prep, **send_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 655, in
send
r = adapter.send(request, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 516, in
send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.libsdl.org', port=443):
Max retries exceeded with url: /release/SDL2-devel-2.0.18-VC.zip (Caused by
NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000237AF075250>:
Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))
===============================================================================
请告诉我如何在离线环境中安装pygame。
我需要你的帮助!!请~~
你可以运行命令:pip install pygame
解决方案 1(对我有用;简单但棘手)
我的第一个建议是使用 .whl
文件。您可以从另一台电脑下载pygame.whl
,这是另一种类型的安装文件,然后将这两个文件移动到没有网络连接的电脑上。
您可以在这里下载文件:
.whl
文件 Window & Python3.9(例如,
pygame-2.1.2-cp39-cp39-win_amd64.whl):
https://pypi.org/project/pygame/#files
实际上,.whl
是一个 zip 文件。你可以解压.whl
文件,然后你可以看到三个文件夹:pygame、pygame-2.1.2.data和pygame-2.1.2.dist-info。您只需要 pygame
个文件夹。
您可以复制该文件夹并将其粘贴到您的 python 项目中。然后你可以简单地import pygame
。我刚刚尝试过这种方式,它对我有用。 (我什至尝试 运行 一个示例游戏)
解决方案 2
另一个建议是从另一台电脑下载pip
和pygame.whl
,然后将这两个文件移动到没有网络连接的电脑上。
您可以在这里下载文件:
- pip(例如 pip-22.0.3.tar.gz):https://pypi.org/project/pip/#files
.whl
文件 Window & Python3.9(例如,
pygame-2.1.2-cp39-cp39-win_amd64.whl):
https://pypi.org/project/pygame/#files
将这两个文件下载并移动到没有互联网连接的计算机后,您首先解压缩 pip-22.0.3.tar.gz
并通过在 pip 文件夹中输入以下命令来安装 pip(pip 也有 setup.py
文件):
python setup.py install
现在,pip
已经安装完成。然后,在 .whl
文件存在的文件夹中使用 pip 使用 .whl
文件进行安装。
python -m pip install pygame-2.1.2-cp39-cp39-win_amd64.whl
希望对您有所帮助pygame
。
我正在尝试在未连接到互联网的计算机上安装 pygame 程序包。
(环境: windows10, python 3.9(蟒蛇))
所以我从 www.pypi.org 下载了一个“pygame-2.1.2.tar”文件,然后尝试安装它
从 cmd 使用“python setup.py 安装”推荐。
然后它会显示如下错误信息
===============================================================================
(base) C:\pythonpackage\pygame-2.1.2>python setup.py install
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Making dir :prebuilt_downloads:
Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.18-VC.zip
d561079ec622b0bab5a9e02976f5d540b0622da
---
For help with compilation see:
https://www.pygame.org/wiki/CompileWindows
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 174, in
_new_conn
conn = connection.create_connection(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 73,
in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\ProgramData\Anaconda3\lib\socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11002] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 699,
in urlopen
httplib_response = self._make_request(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 382,
in _make_request
self._validate_conn(conn)
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 1010,
in _validate_conn
conn.connect()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 358, in
connect
conn = self._new_conn()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 186, in
_new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at
0x00000237AF075250>: Failed to establish a new connection: [Errno 11002] getaddrinfo
failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 439, in
send
resp = conn.urlopen(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 755,
in urlopen
retries = retries.increment(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 574, in
increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.libsdl.org', port=443):
Max retries exceeded with url: /release/SDL2-devel-2.0.18-VC.zip (Caused by
NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000237AF075250>:
Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\pythonpackage\pygame-2.1.2\setup.py", line 359, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\config.py", line 225, in main
deps = CFG.main(**kwds)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\config_win.py", line 497, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 290, in
ask
update(x86=x86, x64=x64)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 273, in
update
download_prebuilts(download_dir, x86=x86, x64=x64)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 124, in
download_prebuilts
download_sha1_unzip(url, checksum, temp_dir, 1)
File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 47, in
download_sha1_unzip
response = requests.get(url)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 542, in
request
resp = self.send(prep, **send_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 655, in
send
r = adapter.send(request, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 516, in
send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.libsdl.org', port=443):
Max retries exceeded with url: /release/SDL2-devel-2.0.18-VC.zip (Caused by
NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000237AF075250>:
Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))
===============================================================================
请告诉我如何在离线环境中安装pygame。
我需要你的帮助!!请~~
你可以运行命令:pip install pygame
解决方案 1(对我有用;简单但棘手)
我的第一个建议是使用 .whl
文件。您可以从另一台电脑下载pygame.whl
,这是另一种类型的安装文件,然后将这两个文件移动到没有网络连接的电脑上。
您可以在这里下载文件:
.whl
文件 Window & Python3.9(例如, pygame-2.1.2-cp39-cp39-win_amd64.whl):
https://pypi.org/project/pygame/#files
实际上,.whl
是一个 zip 文件。你可以解压.whl
文件,然后你可以看到三个文件夹:pygame、pygame-2.1.2.data和pygame-2.1.2.dist-info。您只需要 pygame
个文件夹。
您可以复制该文件夹并将其粘贴到您的 python 项目中。然后你可以简单地import pygame
。我刚刚尝试过这种方式,它对我有用。 (我什至尝试 运行 一个示例游戏)
解决方案 2
另一个建议是从另一台电脑下载pip
和pygame.whl
,然后将这两个文件移动到没有网络连接的电脑上。
您可以在这里下载文件:
- pip(例如 pip-22.0.3.tar.gz):https://pypi.org/project/pip/#files
.whl
文件 Window & Python3.9(例如, pygame-2.1.2-cp39-cp39-win_amd64.whl):
https://pypi.org/project/pygame/#files
将这两个文件下载并移动到没有互联网连接的计算机后,您首先解压缩 pip-22.0.3.tar.gz
并通过在 pip 文件夹中输入以下命令来安装 pip(pip 也有 setup.py
文件):
python setup.py install
现在,pip
已经安装完成。然后,在 .whl
文件存在的文件夹中使用 pip 使用 .whl
文件进行安装。
python -m pip install pygame-2.1.2-cp39-cp39-win_amd64.whl
希望对您有所帮助pygame
。