Python中的地理库问题 [英] Issue with geography library in Python
问题描述
我想使用地理库提取地点的详细信息.我无法安装.我安装了枕头,报纸,lxml,beautifulsoup4和所有nltk Corpas.在安装报纸时,它使我在distribution-0.6.21库中出现了一个错误,因此我安装了它,然后,在尝试安装的每个模块下,我都面临以下错误:
I want to use geography library to extract the details of the places. I am unable to install it. I installed pillow, newspaper, lxml, beautifulsoup4 and all the nltk Corpas. While installing newspaper it was giving me an error in the distribute-0.6.21 library so I installed it and after that, I am facing a below error for every module I am trying to install:
$ conda install newspaper
Traceback (most recent call last):
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 626, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/cli/main.py", line 85, in _main
from ..base.context import context
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/base/context.py", line 18, in <module>
from .._vendor.auxlib.path import expand
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/_vendor/auxlib/path.py", line 8, in <module>
import pkg_resources
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/pkg_resources.py", line 45
def _bypass_ensure_directory(name, mode=0777):
^
SyntaxError: invalid token
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/palakagrawal/anaconda/bin/conda", line 6, in <module>
sys.exit(conda.cli.main())
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/cli/main.py", line 162, in main
return conda_exception_handler(_main, *args)
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 630, in conda_exception_handler
return handle_exception(e)
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 620, in handle_exception
print_unexpected_error_message(e)
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 561, in print_unexpected_error_message
from conda.base.context import context
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/base/context.py", line 18, in <module>
from .._vendor.auxlib.path import expand
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/conda/_vendor/auxlib/path.py", line 8, in <module>
import pkg_resources
File "/Users/palakagrawal/anaconda/lib/python3.5/site-packages/pkg_resources.py", line 45
def _bypass_ensure_directory(name, mode=0777):
^
SyntaxError: invalid token
请帮助我解决上述错误,并为我提供安装地理模块的方法
Please help me with above error and suggest me the way to install geography module
推荐答案
如果您使用的是Python 3,则应确保使用的所有软件包都与Python 3兼容. Python3中的八进制数字语法,因此以下行:
If you're on Python 3, you should make sure all of the packages you use are compatible with Python 3. The error you get is caused by the new octal number syntax in Python3, so the following line:
def _bypass_ensure_directory(name, mode=0777):
应该是:
def _bypass_ensure_directory(name, mode=0o777):
对于Python3.您收到此错误,因为该软件包不是为Python 3设计的.
for Python 3. You're getting this error, as the package was not designed for Python 3.
这篇关于Python中的地理库问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!