问题
I have a problem. I'm trying to install a script written in python. It requires 3.4+ version, and I have python2.7 python3.4 python3.5 installed on my ubuntu 15.10 by default. During setup it throws an error which I found is concerning missing packages in python.
The error is
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'
I looked into source, found list of required packages and made a small script which gives me missing ones
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)`
Output is
Found aiohttp
Found httplib2
Not found socksipy-branch
Found requests
Not found dns
Found url
I tried to install these with synaptic manager, with manual apt-get, with pip, pip3, pip3.4 but with no luck. As I can see from random messages during package installation it installs them into python 2.7, no matter what I do. How do I get them into 3.4 version? Please help me.
来源:https://stackoverflow.com/questions/35600492/import-python-packages-with-different-versions-installed