MacOS 10.15.2 (19C57)
$ brew link --overwrite --dry-run python
Would remove:
/usr/local/bin/python3 -> /opt/homebrew/bin/python3
$ brew link --overwrite python
Linking /usr/local/Cellar/python/3.7.6_1... 24 symlinks created
$ pip3 --version
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 10, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
Fix:
$ sudo vim /Library/Developer/CommandLineTools/usr/bin/pip3
sys.exit(main.main()) <---
For some reason, local install is not working:
$ pip3 install pexpect
Collecting pexpect
Using cached https://files.pythonhosted.org/packages/0e/3e/377007e3f36ec42f1b84ec322ee12141a9e10d808312e5738f52f80a232c/pexpect-4.7.0-py2.py3-none-any.whl
Requirement already satisfied: ptyprocess>=0.5 in /Library/Python/3.7/site-packages (from pexpect) (0.6.0)
Installing collected packages: pexpect
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.7/site-packages/pexpect'
Consider using the `--user` option or check the permissions.
$ pip3 install pexpect --user
Collecting pexpect
Using cached https://files.pythonhosted.org/packages/0e/3e/377007e3f36ec42f1b84ec322ee12141a9e10d808312e5738f52f80a232c/pexpect-4.7.0-py2.py3-none-any.whl
Requirement already satisfied: ptyprocess>=0.5 in /Library/Python/3.7/site-packages (from pexpect) (0.6.0)
Installing collected packages: pexpect
Successfully installed pexpect-4.7.0
$ python3
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pexpect
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/gengwg/Library/Python/3.7/lib/python/site-packages/pexpect/__init__.py", line 75, in <module>
from .pty_spawn import spawn, spawnu
File "/Users/gengwg/Library/Python/3.7/lib/python/site-packages/pexpect/pty_spawn.py", line 10, in <module>
import ptyprocess
ModuleNotFoundError: No module named 'ptyprocess'
>>>
$ pip3 install pyexpect
Collecting pyexpect
Downloading https://files.pythonhosted.org/packages/15/0d/e6bee2bb97dd6835efec72f17264a007efe95bf63bbfd99befd1bd8fab7e/pyexpect-1.0.19.tar.gz
Building wheels for collected packages: pyexpect
Building wheel for pyexpect (setup.py) ... done
Created wheel for pyexpect: filename=pyexpect-1.0.19-cp37-none-any.whl size=25437 sha256=62f551af229bd2e34c35ae336087bd026f4432bb9548b80a81fd859fed5c63ca
Stored in directory: /Users/gengwg/Library/Caches/pip/wheels/0a/97/00/1452d57d85d7e90c158def3e89943d9a5dda507aef9722375e
Successfully built pyexpect
Installing collected packages: pyexpect
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.7/site-packages/pyexpect'
Consider using the `--user` option or check the permissions.
$ sudo !!
sudo pip3 install pyexpect
Password:
WARNING: The directory '/Users/gengwg/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/gengwg/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Processing /Users/gengwg/Library/Caches/pip/wheels/0a/97/00/1452d57d85d7e90c158def3e89943d9a5dda507aef9722375e/pyexpect-1.0.19-cp37-none-any.whl
Installing collected packages: pyexpect
Successfully installed pyexpect-1.0.19
Create a new venv:
$ pyvenv ssh
WARNING: the pyenv script is deprecated in favour of `python3.7 -m venv`
$ source ssh/bin/activate
(ssh) $ pip3 install pexpect
(ssh) $ which python
/Users/gengwg/xyz/ssh/bin/python
(ssh) $ ./ssh/bin/python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>