gpt4 book ai didi

python - google-cloud-bigquery pgk_resources

转载 作者:太空宇宙 更新时间:2023-11-03 17:06:43 25 4
gpt4 key购买 nike

我遵循这个谷歌指南:https://cloud.google.com/bigquery/docs/reference/libraries#client-libraries-install-python运行脚本后出现错误:

    Traceback (most recent call last):
File "/home/pyc6eh4uk/PycharmProjects/fintech_python/bq_jobs/big_query_test.py", line 2, in <module>
from google.cloud import bigquery
File "/usr/local/lib/python2.7/dist-packages/google/cloud/bigquery/__init__.py", line 32, in <module>
__version__ = get_distribution('google-cloud-bigquery').version
File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 311, in get_distribution
if isinstance(dist,Requirement): dist = get_provider(dist)
File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 197, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: google-cloud-bigquery

所以我认为位于我的主目录中的 google-cloud-sdk 和/usr/local/lib/python2.7/dist-packages/google/cloud 中的 bigquery 包之间存在冲突如何避免这种冲突,或者如何设置适用于 google sdk 和 bigqery 的环境?

最佳答案

我刚刚进行了快速测试,无法重现此行为。要隔离问题,您可以通过执行以下操作来使用 virtualenv:

-$virtualenv 测试

-$ pip freeze(确保没有安装任何东西)

-$源测试/bin/activate

-$ pip install --upgrade google-cloud-bigquery

安装后,您可以按照 tutorial 进行操作到目前为止,您正在使用并在 de virtualenv 中执行脚本。完成后,您可以通过运行 $ deactivate

离开 virtualenv

关于python - google-cloud-bigquery pgk_resources,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51032142/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com