我有问题。我正在尝试安装用python编写的脚本。它需要3.4+版本,默认情况下我的ubuntu 15.10上安装了python2.7 python3.4 python3.5。在安装过程中,它会抛出一个错误,我发现它与python中缺少的包有关。
错误是
File "/usr/lib/python3.4/distutils/dist.py", line 1209, in set_requires distutils.versionpredicate.VersionPredicate(v)
File "/usr/lib/python3.4/distutils/versionpredicate.py", line 114, in __init__ raise ValueError("expected parenthesized list: %r" % paren)
ValueError: expected parenthesized list: '-branch'
我查看了源代码,找到了所需包的列表,并制作了一个小脚本,让我找不到它们
import pip
installed_packages = pip.get_installed_distributions()
flat_installed_packages = [package.project_name for package in installed_packages]
packages = [
"aiohttp",
"httplib2",
"socksipy-branch",
"requests",
"dns",
"url"
]
for needle in packages:
if needle in flat_installed_packages:
print('Found ', needle)
else:
print('Not found ', needle)`
输出
Found aiohttp
Found httplib2
Not found socksipy-branch
Found requests
Not found dns
Found url
我尝试用synaptic manager安装这些,手动使用apt-get,使用pip,pip3,pip3.4,但没有运气。正如我在包安装过程中从随机消息中看到的那样,无论我做什么,它都会将它们安装到python 2.7中。如何将它们变成3.4版本?请帮帮我。