It was yesterday that I wanted to do various things with PyGame. Today, I was working on creating a virtual environment so that I could try it on Jupyter Notebook, but I was a little addicted to it.
Here, I will leave the symptom and the remedy as a memo. It seems that not many people have the same symptoms, but I hope it helps.
Windows 10 Python 3.8 conda 4.9.0
It is assumed that the contents introduced in Settings for easy selection of multiple kernels in Jupyter are over.
I thought that the kernel settings were completed, so I immediately entered the virtual environment and started Jupyter Notebook from there, and I got a kernel error.
When I read the message, it said, "I can't import win32api."
If you look at some articles, you will find the following sites. [ImportError: There is no module called win32api](https://www.it-swarm-ja.tech/ja/python/importerror%EF%BC%9Awin32api%E3%81%A8%E3%81%84%E3% 81% 86% E3% 83% A2% E3% 82% B8% E3% 83% A5% E3% 83% BC% E3% 83% AB% E3% 81% AF% E3% 81% 82% E3% 82% 8A% E3% 81% BE% E3% 81% 9B% E3% 82% 93/1043946510 /)
Pypiwin32 seems to be old, so I installed pywin32 with pip instead, but it still doesn't work. If you read further,
Must be run according to pywin32 github
The words. When I went to see github immediately,
Note that if you want to use pywin32 for "system wide" features, such as registering COM objects or implementing Windows Services, then you must run the following command from an elevated command prompt:
python Scripts/pywin32_postinstall.py -install
I don't know about half of it, but if you want to use it system-wide (cross-cutting?), You have to register with the Windows service, so I went to the Scripts storage (in my case, directly under the Anaconda3 file) and specified it. When I ran the command, it finally worked.
I created a virtual environment that can also use Jupyter Notebook before, but I don't remember getting stuck in such a swamp at that time.
Probably, the Python version at that time was 3.6 or 3.5, but this time it may be because it was specified by Pygame and 3.8 was installed when creating the virtual environment.
Thank you for collective intelligence.
Recommended Posts