Tag Archives: pip

How to Solve Error in installing MySQL Python in 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
#include “Python.h”
^
compilation terminated.
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

 

Handling method of PIP error in pycharm installation

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

 

Mac OS uses pip to install pandas prompt cannot install ‘numpy’ solution

When I was rebuilding my computer’s plotly environment, I encountered a problem, that is, when I used pip to install pandas, I always prompted:

pip uninstall numpy
Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Due to the limited level of English, at the beginning of the period, I thought it was due to insufficient authority, and sudo still reported an error. After translating with the help of tools, it is found that numpy cannot be unloaded for the following reasons:

This is a distutils installed project, so we cannot determine exactly which files belong to it, which would result in only a partial uninstallation.

Numpy is a standard library. It reminds me that some software in the windows system will be placed in the system folder when it is installed. As a result, the prompt can not accurately identify the files that need to be unloaded and deleted, resulting in the failure of unloading. Although it is not clear why numpy needs to be uninstalled before pandas is installed, PIP is used to install a wave first. The tips are as follows:

Requirement already satisfied: numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (1.8.0rc1)

Still can’t, simply delete directly. To remind you, backup first, and then install numpy again after installation, so it’s safer

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python$ ls | grep numpy
numpy-1.8.0rc1-py2.7.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python$ sudo mv numpy-1.8.0rc1-py2.7.egg-info /Users/fv/
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python$

There are also some pitfalls: looking at the foreign netizens, there are many bugs in the version of 3. + and I really want to roll back to 2.4. New computers must pay attention to the version of the relevant dependency library. Sometimes the plot prompt can’t find the module, just because the version is too low

[Solved] Fatal error in launcher: unable to create process using ‘”‘

 

Coexistence environment of python3 and python2 under win7

Installing a package with pip
When executing pip2 install xxx, an error is reported
Fatal error in launcher: Unable to create process using '"'

The same error is reported when executing pip3 install xxx
Fatal error in launcher: Unable to create process using '"'


Solution
python2 -m pip install XXX
python3 -m pip install XXX

This will allow you to use pip to install the module properly

How to install PIP in no module named setuptools

ImportError: No module named setuptools [How to Solve]

wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz –no-check-certificate

tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
python setup.py install

pip install

wget--no-check-certificatehttps://github.com/pypa/pip/archive/1.5.5.tar.gz

Note: when WGet gets HTTPS: – – no check certificate should be added

tarzvxf1.5.5.tar.gz#unzip file cdpip-1.5.5/
pythonsetup.pyinstall

OK, so pip is installed

Let’s install requests

pipinstallrequests

 

Windows: PIP Install error: Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat

Just after installing PIP in Windows environment on the machine, it is convenient to use it when installing the package in the future. Who knows that when using pip to install asyncio for the first time, it will report an error

when using PIP installation package under windows7x64, you will be prompted to report an error: Microsoft Visual C + + 9.0 is required (unable to find vcfarsall. Bat)

environment: windows7 x64, python2.7, vs2012

reason: when using PIP installation package under windows, you need VS2008 installed on the machine, but vs2012 is not enough, if you don’t want to install VS2008, You can install a package of Micorsoft Visual C + + compiler for Python 2.7

Upgrade pip Error: ”’SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED]…”

Upgraded pip and encountered the following error reported.

PS C:\temp> python -m pip install –upgrade pip
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)’))’: /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)’))’: /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)’))’: /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)’))’: /simple/pip/
ERROR: Operation cancelled by user
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=’pypi.org’, port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)’))) – skipping

 

The solution is to specify the trusted host, as follows.

PS C:\temp> python -m pip install –upgrade pip –trusted-host pypi.org –trusted-host files.pythonhosted.org
Collecting pip
Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
|████████████████████████████████| 1.5MB 242kB/s
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-20.1.1