ImportError: No module named ‘requests’

Detailed map traversal, teach you to master the complex gremlin query debugging method>>>

Supplementary notes:

The current environment is under Windows
environment

The python version is: Python 3.4.
the

At the beginning of learning python, I read interesting code in the forum while reading, http://www.oschina.net/code/snippet_ 1406266_ 43470 code operation error and solutions

1.ImportError: No module named ‘requests’

Traceback (most recent call last):

File “piece_ full_ down_ image.py”, line 2, in < module>

Import requests

importerror: no module named ‘requests’

can’t find the requests module.

there are two solutions: automatically install the third party requests module and manually download and install the requests module

automatic installation:

when Python is installed and the path of Python is configured to path, you can directly call PIP install requests in CMD for automatic installation

if you want to delete it, you can use the PIP install requests command. It is found that sometimes the deletion of manual installation is not clean

manual installation:

manual installation https://pypi.python.org/pypi/requests#downloads Download the requests installation package from

the python third-party module usually comes with the setup.py file. In Windows environment, we only need to use the command

CD C:

Python setup.py install

to complete the installation of the third-party module. The first CD command switches the current directory of the third-party module to be installed (assume that the directory after decompressing the third-party module is C::?Temp?Foo), and the second command executes the installation. During the installation process, the error prompt “importerror: no module named setuptools” may appear, which is often encountered by novices. Don’t worry, this is because Python doesn’t install the module of setuptools by default in Windows environment, which is also a third-party module. The download address is http://pypi.python.org/pypi/setuptools 。

2. Missing the beautifulsoup module

Traceback (most recent call last):

File “piece_ full_ down_ image.py”, line 3, in < module>

from BS4 import beautiful soup

importerror: no module named ‘BS4’

according to the error report, the missing module is caused by the code from BS4 import beautiful soup. Query the data and find that it is a missing beautiful soup. Start the installation according to the above command

execute PIP install beautiful soup, prompt error message, try to install manually again, enter http://www.crummy.com/software/BeautifulSoup/#Download Or search the official website, execute setup installation, and the result shows that the print “” error

the reason is that I installed version 3.4, which is different from Python version 2. X in that I changed print “” to print (“

I’m just a beginner. Just playing python, let me study the difference between 2. X and 3. X, decisively delete Python 3.4 and install Python 2.7.8 instead

Similar Posts: