Use the command easy_ Install install pip
Use the command sudo easy_Install PIP
installing PIP failed. The information of executing the command is as follows:
➜ ~ sudo easy_install pip
Password:
Searching for pip
Reading https://pypi.org/simple/pip/
Downloading https://files.pythonhosted.org/packages/da/f6/c83229dcc3635cdeb51874184241a9508ada15d8baa337a41093fab58011/pip-21.3.1.tar.gz#sha256=fd11ba3d0fdb4c07fbc5ecbba0b1b719809420f25038f8ee3cd913d3faa3033a
Best match: pip 21.3.1
Processing pip-21.3.1.tar.gz
Writing /tmp/easy_install-8XXfb1/pip-21.3.1/setup.cfg
Running pip-21.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8XXfb1/pip-21.3.1/egg-dist-tmp-5cqtMF
Traceback (most recent call last):
# ...
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 44, in _execfile
code = compile(script, filename, 'exec')
File "/tmp/easy_install-8XXfb1/pip-21.3.1/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
Solution
Download the script file get-pip.py:
curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py
Then execute the script file get-pip.py with the command python3:
sudo python3 get-pip.py
This completes the installation.
The process information of executing the command is as follows:
➜ ~ curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2108k 100 2108k 0 0 2571k 0 --:--:-- --:--:-- --:--:-- 2568k
➜ ~ sudo python3 get-pip.py
Password:
WARNING: The directory '/Users/liaowenxiong/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 1.0 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.4
Uninstalling pip-21.2.4:
Successfully uninstalled pip-21.2.4
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Successfully installed pip-21.3.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
➜ ~ pip --version
pip 21.3.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
A simpler command to execute is as follows:
curl https://bootstrap.pypa.io/get-pip.py | python3
Uninstall pip
sudo pip uninstall pip
Read More:
- [Solved] PIP Install tensorflow error: syntax error: invalid syntax
- Python syntax error except exception, e: ^ syntax error: invalid syntax
- How to Solve PIP3 error After upgrading pip3 install –upgrade pip
- [Solved] sys.stderr.write(f“ERROR: {exc}“) ^ SyntaxError: invalid syntax
- Python 2.7: How to Install PIP
- [Solved] Python operate Kafka error: SyntaxError: invalid syntax
- [Solved] rdd.foreach(print) Error: SyntaxError: invalid syntax
- Pip3 install Mysqlclient Error: Command “python setup.py egg_info“ failed with error
- Python Error: pip install mysql-connector-python failed
- Python Use PIP to install pyinstaller Error [Solved]
- How to Solve PIP Install fasttext Error
- [Solved] Pycharm Use pip to install package error: no such option –build-dir
- Pip Installation Warning: can’t install the package because of EnvironmentError
- PIP Install Mysqlclient error C1083: Cannot open include file: ‘mysql.h‘: No such file or directory
- [Solved] pip Install Error: Missing dependencies for SOCKS support
- [Solved] pip install Error: There was a problem confirming the ssl certificate…
- [Solved] Python sqlite3.OperationalError: near “?“: syntax error
- [Solved] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- PIP Install Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)’))
- Python_Syntax error: unexpected character after line continuation character