Python 2.7:can';t安装/查找任何依赖项
我运行的是Python 2.7.10,即使使用pip成功安装了它们,我似乎也无法满足任何依赖项:Python 2.7:can';t安装/查找任何依赖项,python,python-2.7,pip,Python,Python 2.7,Pip,我运行的是Python 2.7.10,即使使用pip成功安装了它们,我似乎也无法满足任何依赖项: >python --version Python 2.7.10 >sudo -H pip install parse DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintaine
>python --version
Python 2.7.10
>sudo -H pip install parse
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: parse in /Library/Python/2.7/site-packages (1.12.0)
>python myScript.py
Traceback (most recent call last):
File "myScript.py", line 3, in <module>
from urllib.parse import urlparse
ImportError: No module named parse
上面我的脚本抱怨模块parse
找不到,尽管我已经使用pip安装了它。我正在尝试使用的其他库也是如此
这是为什么?是python3,也就是说,看起来您的脚本是为python3编写的
在python2中是
所以用python3运行它。到现在为止,您应该已经在使用python3了
附带说明:您安装的软件包是用于不同的用途的—要解析字符串,您真的不应该使用sudo(或者在系统的python2中安装库)。使用
pyenv
和/或获取Python3
from urllib.parse import urlparse