no module named urllib.parse (How should I install it?)

后端 未结 11 623
青春惊慌失措
青春惊慌失措 2020-12-03 02:49

I\'m trying to run a REST API on CentOS 7, I read urllib.parse is in Python 3 but I\'m using Python 2.7.5 so I don\'t know how to install this module.

I installed al

11条回答
  •  死守一世寂寞
    2020-12-03 02:58

    The urlparse in Python 2.7.11 was renamed to urllib.parse in Python 3. So, if you have a code such from urlparse import urlparse, I suggest you change it to from urllib.parse import urlparse Since you are using python 2.7.5, using the below will solve your poblem

    from urlparse import urlparse
    

    Instead of from urllib.parse import urlparse

提交回复
热议问题