默认的python版本是2.7.3,我安装python2.7.10,如下所示:
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz tar xzf Python-2.7.10.tgz $ cd Python-2.7.10 $ sudo ./configure $ sudo make $ sudo make install
然后,python升级到2.7.10
root@ubuntu:/# python Python 2.7.10 (default, Aug 29 2017, 10:24:22) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
并安装请求库:
root@ubuntu:/# pip install requests Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python2.7/dist-packages Requirement already satisfied (use --upgrade to upgrade): chardet>=3.0.2,=2.5,=1.21.1,=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests) Cleaning up... root@ubuntu:/#
但它没有名为request
的模块>>> import requests Traceback (most recent call last): File "", line 1, in ImportError: No module named requests >>>
但我怎样才能解决问题?请...