My usual workflow for manually installing python modules doesn't work since I upgraded to python3.9 on my mac. Suppose I want to install a custom module called "myfiles" from the setup script, I do
cd myfiles
python3 setup.py install --user
The output contains the line
Extracting myfiles-1.6.1-py3.9.egg to /Users/antonius/Library/Python/3.9/lib/python3.9/site-packages
When I inspect the content of sys.path
, I see the directory
/Users/antonius/Library/Python/3.9/lib/python/site-packages
as well as all other directories under it. However, the directory
/Users/antonius/Library/Python/3.9/lib/python3.9/site-packages
does not appear in the list of paths. Even if I edit my ~/.zshrc
to include the line
export PYTHONPATH="/Users/antonius/Library/Python/3.9/lib/python3.9/site-packages:$PYTHONPATH"
then the list of paths contains this directory, but does not contain any of the directories under it, so I cannot import my module.
What is going on? How do I tell python to expand the list of paths from the content of the site-packages/
directory? Even then, it doesn't seem right that I need to add that path in my ~/.zshrc
.
Btw, the content of my ~/.pydistutils.cfg
file is just
[install]
prefix=
CodePudding user response:
Use pip
. pip install --user .
will do the same thing. setup.py is deprecated.