I became unemployed again. I decided to study while looking for a job in order to improve my technical skills during the NEET period.
A long time ago, he was enthusiastic about the Perl language, but lived away for several years. Perhaps he seemed to have an affair, he had an attitude that he couldn't understand at first glance in the Perl language. It may be a problem for me who didn't give it up, but I'm going to divide it as it is. It's a huge book fee that I don't know how much I spent, but I think there was a problem with my one-sided tribute and decided to give up. I'm going to change my mind and get serious about different scripting languages. However, I haven't decided on my favorite yet.
I have two ideas now.
I want to do text processing, but apart from the Perl language, the above two points seem to be hard to compare. The Go language was easier to get used to when I touched it. After a few weeks or months, you may have forgotten how to use it, even if it's a small process. Still, the daily life of text processing does not change (and I don't use it every day, so I forget about it). Therefore, from the GUI screen, I decided that there would be no problem in text processing even if I forgot the processing contents.
So, if it's GUI programming, Python will be better off. GUI development in Go language is still under development, and it is a high threshold for me who has escaped from Perl language.
Therefore, first aim to learn the Python language. Above all, it seems to have a high affinity with Excel, and the range of applications seems to be wide-ranging.
Even if you can do the same thing in Go language, you can't work on it because there is no information. I'm very sorry, but it can't be helped.
With this post, I'm completely separated from the Perl language. Don't be afraid to become a Buddhahood.
I have Python3 installed, and I have pip3 and pygame installed. I run the program ...
prompt
No module named 'pygame'
Why? You have Pygame installed, right?
I don't like it and the environment construction has failed, but it seems that it will fail just by installing it normally.
Hereafter, reinstall it.
prompt
[Qiita@chesscommands ~] $ pip3 install pygame
Looking in indexes: https://pypi.python.org/simple/
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
Building wheels for collected packages: pygame
Building wheel for pygame (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/[email protected]/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/setup.py'"'"'; __file__='"'"'/private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-wheel-mzz_891j
cwd: /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/
Complete output (219 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.8
creating build/lib.macosx-10.14-x86_64-3.8/pygame
・
・
・
In file included from src_c/gfxdraw.c:33:
In file included from src_c/pygame.h:32:
src_c/_pygame.h:216:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
^~~~~~~
1 error generated.
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pygame
Running setup.py clean for pygame
Failed to build pygame
Installing collected packages: pygame
Running setup.py install for pygame ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/[email protected]/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/setup.py'"'"'; __file__='"'"'/private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-record-gfvc3z2_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pygame
cwd: /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/
Complete output (219 lines):
running install
running build
running build_py
・
・
・
running build_ext
building 'pygame.gfxdraw' extension
creating build/temp.macosx-10.14-x86_64-3.8
creating build/temp.macosx-10.14-x86_64-3.8/src_c
creating build/temp.macosx-10.14-x86_64-3.8/src_c/SDL_gfx
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/opt/tcl-tk/include -DENABLE_NEWBUF=1 -I/NEED_INC_PATH_FIX -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src_c/gfxdraw.c -o build/temp.macosx-10.14-x86_64-3.8/src_c/gfxdraw.o
In file included from src_c/gfxdraw.c:33:
In file included from src_c/pygame.h:32:
src_c/_pygame.h:216:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
^~~~~~~
1 error generated.
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/[email protected]/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/setup.py'"'"'; __file__='"'"'/private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-install-mv9vk7gl/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-record-gfvc3z2_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pygame Check the logs for full command output.
[Qiita@chesscommands ~] $
Why?
I don't know about clang, but XCode is already installed, and the console version is already installed. However, it may be because the version remains old. When upgrading the version, it is necessary to upgrade each OS. I want to avoid it. It's still too early to make the default shell Zsh.
By saying that, look for other measures.
I don't know what to do, so I decided to install the program described in the URL displayed in the error.
prompt
[Qiita@chesscommands ~] $ pip3 install pygame
Looking in indexes: https://pypi.python.org/simple/
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
Building wheels for collected packages: pygame
Building wheel for pygame (setup.py) ... error
ERROR: Command errored out with exit status 1:
[Qiita@chesscommands ~] $ brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf
[Qiita@chesscommands ~] $ brew install Caskroom/cask/xquartz #Installation failure
[Qiita@chesscommands ~] $ brew cask install atom #I succeeded when I tried again(The command is completely different: xquartz)。
[Qiita@chesscommands ~] $ pip3 install git+https://github.com/pygame/pygame.git #Normally"pygame"Is it not enough?
Looking in indexes: https://pypi.python.org/simple/
Collecting git+https://github.com/pygame/pygame.git
Cloning https://github.com/pygame/pygame.git to /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-req-build-lblaxp95
Building wheels for collected packages: pygame
Building wheel for pygame (setup.py) ... done
Created wheel for pygame: filename=pygame-2.0.0.dev25-cp38-cp38-macosx_10_14_x86_64.whl size=2700971 sha256=a4345c1a9b5cedd13c4d0bb72fc2fe0440faab6b59c8b4a86d54f24497d70b8f
Stored in directory: /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-ephem-wheel-cache-tiw9vcxx/wheels/32/d1/04/414f72352cfabeed1483d1fd1209ce2f0c0354ce830b31e97a
Successfully built pygame
Installing collected packages: pygame
Successfully installed pygame-2.0.0.dev25
[Qiita@chesscommands ~] $ python -m pygame.tests
Error while finding module specification for 'pygame.tests' (ModuleNotFoundError: No module named 'pygame')
[Qiita@chesscommands ~] $
Why?
For the time being, list display.
prompt
[Qiita@chesscommands ~] $ pip3 list
Package Version
---------- -----------
pip 20.2.3
pygame 2.0.0.dev25
setuptools 50.3.0
wheel 0.35.1
[Qiita@chesscommands ~] $ pip list
Package Version
---------- -------
pip 20.2.4
setuptools 49.2.1
wheel 0.35.1
[Qiita@chesscommands ~] $
I don't think so ...
prompt
[Qiita@chesscommands ~] $ pip install git+https://github.com/pygame/pygame.git
Looking in indexes: https://pypi.python.org/simple/
Collecting git+https://github.com/pygame/pygame.git
Cloning https://github.com/pygame/pygame.git to /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-req-build-s0y_ogtz
Building wheels for collected packages: pygame
Building wheel for pygame (setup.py) ... done
Created wheel for pygame: filename=pygame-2.0.0.dev25-cp38-cp38-macosx_10_14_x86_64.whl size=2700817 sha256=4d6ef61530695b792fe8dc4e50981228b9681195c14b0d262994529fe71b20f2
Stored in directory: /private/var/folders/6j/3sb382wn1hq6d63_xbk_5m6w0000gn/T/pip-ephem-wheel-cache-yjzzgpjo/wheels/32/d1/04/414f72352cfabeed1483d1fd1209ce2f0c0354ce830b31e97a
Successfully built pygame
Installing collected packages: pygame
Successfully installed pygame-2.0.0.dev25
[Qiita@chesscommands ~] $ pip3 list
Package Version
---------- -----------
pip 20.2.3
pygame 2.0.0.dev25
setuptools 50.3.0
wheel 0.35.1
[Qiita@chesscommands ~] $ pip list
Package Version
---------- -----------
pip 20.2.4
pygame 2.0.0.dev25
setuptools 49.2.1
wheel 0.35.1
[Qiita@chesscommands ~] $
Well ...
prompt
[Qiita@chesscommands ~] $ python -m pygame.tests
pygame 2.0.0.dev25 (SDL 2.0.12, python 3.8.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
skipping pygame.tests.cdrom_test (tag 'interactive')
skipping pygame.tests.overlay_test (tag 'SDL2_ignore')
skipping pygame.tests.scrap_test (tag 'SDL2_ignore')
skipping pygame.tests.sndarray_test (tag 'ignore')
skipping pygame.tests.surfarray_test (tag 'ignore')
loading pygame.tests.base_test
・
・
・
ModuleNotFoundError: No module named 'pygame.pypm'
======================================================================
ERROR: test_midis2events__missing_event_data (pygame.tests.midi_test.MidiModuleNonInteractiveTest)
Ensures midi events with missing values are handled properly.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/chesscommands/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pygame/tests/midi_test.py", line 344, in setUp
import pygame.midi
File "/Users/chesscommands/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pygame/midi.py", line 35, in <module>
import pygame.pypm as _pypm
ModuleNotFoundError: No module named 'pygame.pypm'
----------------------------------------------------------------------
Ran 1608 tests in 81.905s
FAILED (errors=8)
[Qiita@chesscommands ~] $
you're kidding!? There was an error, but there was progress. Are pip and pip3 different?
I have no plans to use python2 in the first place, but ...
Version confirmation including Path.
prompt
[Qiita@chesscommands ~] $ pyenv version
3.8.6 (set by /Users/chesscommands/.python-version)
[Qiita@chesscommands ~] $ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
[Qiita@chesscommands ~] $ pyenv global 3.8.6
[Qiita@chesscommands ~] $ pyenv local 3.8.6
[Qiita@chesscommands ~] $ pyenv rehash
[Qiita@chesscommands ~] $ whereis python
/usr/bin/python
[Qiita@chesscommands ~] $/usr/bin/python --version
Python 2.7.16
[Qiita@chesscommands ~] $ python --version
Python 3.8.6
[Qiita@chesscommands ~] $ pyenv version
3.8.6 (set by /Users/chesscommands/.python-version)
[Qiita@chesscommands ~] $
Why?
Why is the bin subordinate preferentially used when at least the local subordinate should be prioritized?
Check environment variables
prompt
[Qiita@chesscommands ~] $ echo $PATH
/Users/chesscommands/.python-version:/usr/local/opt/tcl-tk/bin:/Users/chesscommands/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/MacVim.app/Contents/MacOS/
[Qiita@chesscommands ~] $
Yup. I don't think there is anything strange about it ... Line breaks below for easy viewing.
/Users/chesscommands/.python-version
/usr/local/opt/tcl-tk/bin
/Users/chesscommands/.pyenv/shims
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Applications/VMware Fusion.app/Contents/Public
/usr/local/go/bin
/usr/local/share/dotnet
~/.dotnet/tools
/Library/Frameworks/Mono.framework/Versions/Current/Commands
/Applications/MacVim.app/Contents/MacOS/
I didn't put any / usr / local / bin
in my .bash_profile.
And yet, it exists.
What do you mean?
Below is an excerpt of the contents of .bash_profile.
prompt
VIM=/Applications/MacVim.app/Contents/MacOS/
PATH=$PATH:${VIM}
PATH="/usr/local/opt/tcl-tk/bin:$PATH"
PATH="/Users/chesscommands/.python-version:$PATH"
export PATH
In other files, I haven't tampered with the PATH, and it's unpleasant to add something that I don't know where it's set, even though it's just this file and only this setting. aside from that,
prompt
[Qiita@chesscommands ~] $ ll /etc/paths.d/
total 40
-r--r--r-- 1 root wheel 47 10 9 00:33 com.vmware.fusion.public
-rw-r--r-- 1 root wheel 15 9 28 16:20 dotnet-cli-tools
-rw-r--r-- 1 root wheel 24 9 28 16:20 dotnet
-rw-r--r-- 1 root wheel 61 9 27 10:29 mono-commands
-rw-r--r-- 1 root wheel 18 9 10 03:55 go
[Qiita@chesscommands ~] $ ll /etc/manpaths.d/
[Qiita@chesscommands ~] $ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
[Qiita@chesscommands ~] $ cat /etc/manpaths
/usr/share/man
/usr/local/share/man
[Qiita@chesscommands ~] $
Yup. Where are the other settings?
If you've read this far, you may have forgotten the first explanation, but you've got an error running the pygame sample. However, I was able to run the sample program of the book I was reading for study, and no error occurred. Therefore, I am satisfied with it.
As I mentioned at the beginning, GUI development of Go language is hopeless, but for the time being. With that said, as in "Introduction to Easy Go Language", enter commands, build a Go language development environment, and then introduce a GUI development environment.
prompt
[chesscommands@Qiita ~] $ go get golang.org/x/exp/shiny
package golang.org/x/exp/shiny: no Go files in /Users/chesscommands/go/src/golang.org/x/exp/shiny
[chesscommands@Qiita ~] $
Why? Certainly, in the book, it was as if something was written at the end of the path shiny, but there was no specific description. So I thought I could omit it ...
prompt
[chesscommands@Qiita ~] $ go get golang.org/x/exp/shiny/...
[chesscommands@Qiita ~] $ echo $?
0
[chesscommands@Qiita ~] $
you're kidding. I wondered if I succeeded when I typed in the symbol I thought I would omit.
And I made a sample program according to the book, but it doesn't work well.
prompt
Failed to get state - detached from the process
Process exiting with code: 0
The program ends abnormally. Yup.
However, it looks like it was done, so let's judge that there is no problem. After all, it's far from full-scale GUI development, and I'm reading the first page of a beginner's book ... It's a long way to go, but I have time because I'm unemployed. Let's acquire technical skills and do our best in job hunting.
I like Python, which makes it easy to start GUI development (although it took a lot of time to build the environment). It's easy to motivate because it's GUI development. It's good to mess around on the console, but it's easy to lose sight of your purpose, so I want to make a small game with GUI development to gain confidence in order to clarify my motivation. Until then, if you are told that it is not suitable for programmers because you will not program unless you make an effort.
Go language is easy to learn (I like the automatic formatting of the IDE). And both are difficult to learn.
No way, I wouldn't spend a few weeks building an environment ... that's all.
PS. It's also unpleasant that "~ / .dotnet / tools" is included in the PATH. I think it's a useless and garbage path, but I can't erase it. Creepy.
Recommended Posts