e.g. pip install pyparsing==1.5.7 install Error: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-WImLdR/pyparsing/
sudo python -m pip install –upgrade –force pip
sudo pip install setuptools==40.8.0
1. Install dependent packages
yum -y install zlib*
2. Recompile Python
#The catalog is based on the production environment itself [[email protected] software]# cd Python/ [[email protected] Python]# ./configure --prefix=/usr/local/python3 #Compile and install [[email protected] Python]# make && make install # re-install curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3 get-pip.py
step1: Repair: python -m ensurepip
step2: Installation: python -m pip install –upgrade pip
Original text: https://blog.csdn.net/weixin_ 39278265/article/details/82938270
You need to modify the directory referenced in the pip.exe file in the scripts directory of the virtual environment.
Referring to the original text, I used Notepad + + to open pip.exe, and then searched according to the python path information prompted,
After finding it, replace it with the path of python.exe in the current virtual environment and save it.
[[email protected] ~]$ https://bootstrap.pypa.io/get-pip.py [[email protected] ~]$ sudo python get-pip.py
The error message “zipimport.ZipImportError: can’t decompress data; zlib not available”
It seems that the zlib library is missing and needs to be installed before execution.
After the installation was completed, we found that it still reported an error, and a Google search revealed that we needed to install zlib-dev
So we install the zlib library again
This time the installation should be OK, but the result is disappointing, it still gives the same error.
But we have already installed the zlib library, why does it still give us an error?
We need to recompile and install python
Before recompiling, we need to modify the Modules/Setup.dist file in the installation source file to change the
The comment on this line is removed and becomes
Then compile and install it again (execute the following command in Python’s installation source directory)
Install pip successfully!
Get the repair file get-pip.py
Access get repair file
Find the download link of the corresponding version file, such as Python 3.5, https://bootstrap.pypa.io/pip/3.5/get-pip.py
Download using WGet, WGet https://bootstrap.pypa.io/pip/3.5/get-pip.py
Execute the file using the corresponding version of python,
Python 3.5 get pip. Py
Screenshot of error reporting:
First, put Anaconda’s bin and script into the environment variable
Then CONDA install PIP updates the PIP
Error 1: EnvironmentError: mysql_config not found
Solution: yum install mysql-devel
Error 2: Python.h No such file or directory
For more errors see the following lines.
_mysql.c:29:20: fatal error: Python.h: No such file or directory
error: command ‘gcc’ failed with exit status 1
Solution: yum install python-devel.x86_64
In fact, these two errors are one and the same, both are not installed python-devel, only error 2 is 64-bit
“These packages do not match the hashes from the requirements file.”
when the above error prompt appears, it indicates that the download failed due to network problems. If you repeatedly use PIP install to install, an error will be reported
The solution is as follows:
pip install --upgrade packageName
When using pycharm these days, I found that I reported it when installing the software module ‘pip’ has no attribute ‘main’ , later, the online methods and analysis error prompts were integrated because there was a packaging in the pycharm installation directory_There are two pieces of code in the tool.py file. There are some problems with the configuration and some changes need to be made
The original code is as follows:
1 def do_install(pkgs): 2 3 try: 4 import pip 5 except ImportError: 6 error_no_pip() 7 return pip.main(['install'] + pkgs) 8 9 10 def do_uninstall(pkgs): 11 try: 12 import pip 13 except ImportError: 14 error_no_pip() 15 return pip.main(['uninstall', '-y'] + pkgs)
Modify it to the following code:
1 def do_install(pkgs): 2 3 try: 4 #import pip 5 try: 6 from pip._internal import main 7 except Exception: 8 from pip import main 9 except ImportError: 10 error_no_pip() 11 return main(['install'] + pkgs) 12 13 14 def do_uninstall(pkgs): 15 try: 16 #import pip 17 try: 18 from pip._internal import main 19 except Exception: 20 from pip import main 21 except ImportError: 22 error_no_pip() 23 return main(['uninstall', '-y'] + pkgs)
If you report an error after modification, it may be a problem of indentation. You must pay attention to the indentation of the code. Python’s indentation requirements can be called abnormal