There are twelve executables named
python
on my intel macbook pro. None of them are in my path, but "python3" in my path points to version 3.13.4 installed by homebrew.
When I try python3 -m pip install pinyin
I get two screens of diagnostics, starting with
× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.
but brew install pip
says there is no formula for pip.
I need to run a python script that starts with
import sys
import re
import pinyin
but it errs with a complaint about pinyin on line 3
I also tried doing it with the Apple-installed P{ython, but no success there either.
Advice?
Update: After studying those two screens of diagnostics, it seemed to advise me to install and use pipx
instead. So I did that, and then pipx install pinyin
said pinyin is already installed! So I tried running the intended command again and got the same complaint:
WGroleau@MacBookPro pinyin % python3 convert_pinyin.py test.pinyin.php test.pinyin.php
Traceback (most recent call last):
File "/Users/WGroleau/ChiCal/pinyin/convert_pinyin.py", line 3, in
import pinyin
ModuleNotFoundError: No module named 'pinyin'
WGroleau@MacBookPro pinyin %
Asked by WGroleau
(5370 rep)
Jun 9, 2025, 12:41 AM
Last activity: Jun 9, 2025, 06:47 AM
Last activity: Jun 9, 2025, 06:47 AM