我尝试安装urlparse4时发生错误

时间:2020-05-31 15:51:23

标签: python-3.x

pip install urlparse4
Collecting urlparse4
  Using cached urlparse4-0.1.3.tar.gz (158 kB)
    ERROR: Command errored out with exit status 1:
     command: /opt/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5d/s05y8m4107z_tgvnq4z02kdr0000gp/T/pip-install-4dhc591p/urlparse4/setup.py'"'"'; __file__='"'"'/private/var/folders/5d/s05y8m4107z_tgvnq4z02kdr0000gp/T/pip-install-4dhc591p/urlparse4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/5d/s05y8m4107z_tgvnq4z02kdr0000gp/T/pip-pip-egg-info-me23x0q2
         cwd: /private/var/folders/5d/s05y8m4107z_tgvnq4z02kdr0000gp/T/pip-install-4dhc591p/urlparse4/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/5d/s05y8m4107z_tgvnq4z02kdr0000gp/T/pip-install-4dhc591p/urlparse4/setup.py", line 46
        print "urlparse4/gurl.cpp not found and Cython failed to run to recreate it. Please install/upgrade Cython and try again."
                                                                                                                                 ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("urlparse4/gurl.cpp not found and Cython failed to run to recreate it. Please install/upgrade Cython and try again.")?
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

亲爱的,是什么引起了这个问题,我可以解决它吗?提前非常感谢!

1 个答案:

答案 0 :(得分:0)

urlparse模块仅支持Python2.7。 (请参见https://pypi.org/project/urlparse4/

在Python3中,您应该改用urllib.parse

import urllib.parse

更多信息:How can i import urlparse in python-3?