I am working on a project related to Google Maps, and interested to use polyline package. My system is Ubuntu 15.10 (just recently upgraded). And as usual, I use pip3 to do the job:
It installs the package properly. No error message comes out. However, when I try to import it using Python3, python throws some error message:
How comes?
Looking at it again, apparently there is something interesting here. Somehow, command pip3 above installs the package to Python 3.5, which is installed when we upgrade to Ubuntu 15.10, while command python3 is still referring to python3.4!
One way to fix this is to correct the command python3 to point towards python3.5 (so that we can use the latest Python 3 version), which is located in /usr/bin/python3.5 :
Trying to import the package again:
It works now! The problem is that now we have to re-install all packages to our python 3.5,
root@Kirana:/usr/lib/python3/dist-packages# pip3 install polyline Downloading/unpacking polyline Downloading polyline-1.1.tar.gz Running setup.py (path:/tmp/pip-build-l9ch5_49/polyline/setup.py) egg_info for package polyline Requirement already satisfied (use --upgrade to upgrade): six==1.8.0 in /usr/local/lib/python3.5/dist-packages (from polyline) Installing collected packages: polyline Running setup.py install for polyline Successfully installed polyline Cleaning up...
It installs the package properly. No error message comes out. However, when I try to import it using Python3, python throws some error message:
> python3 Python 3.4.3+ (default, Oct 14 2015, 16:03:50) [GCC 5.2.1 20151010] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from polyline.codec import PolylineCodec Traceback (most recent call last): File "", line 1, in ImportError: No module named 'polyline'
How comes?
Looking at it again, apparently there is something interesting here. Somehow, command pip3 above installs the package to Python 3.5, which is installed when we upgrade to Ubuntu 15.10, while command python3 is still referring to python3.4!
One way to fix this is to correct the command python3 to point towards python3.5 (so that we can use the latest Python 3 version), which is located in /usr/bin/python3.5 :
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 10
Trying to import the package again:
> python3 Python 3.5.0+ (default, Oct 11 2015, 09:05:38) [GCC 5.2.1 20151010] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from polyline.codec import PolylineCodec >>>
It works now! The problem is that now we have to re-install all packages to our python 3.5,
Thankyou for such a great article.
ReplyDeleteBangalore escorts | Escorts in Bangalore