安装完成tensorFlow之后,测试时报错No module named pkg_resources

来源:3-10 安装TensorFlow(上)

clodCode

2019-01-31

版本信息
python version: Python 2.7.15
tensorFlow version: tensorFlow 1.12.0

运行代码:
import tensorflow

报错提示:
Traceback (most recent call last):
File “”, line 1, in
File “/Users/tangchao/Library/Python/2.7/lib/python/site-packages/tensorflow/init.py”, line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File “/Users/tangchao/Library/Python/2.7/lib/python/site-packages/tensorflow/python/init.py”, line 127, in
from tensorflow.python.platform import test
File “/Users/tangchao/Library/Python/2.7/lib/python/site-packages/tensorflow/python/platform/test.py”, line 47, in
import mock # pylint: disable=g-import-not-at-top,unused-import
File “/Users/tangchao/Library/Python/2.7/lib/python/site-packages/mock/init.py”, line 2, in
import mock.mock as _mock
File “/Users/tangchao/Library/Python/2.7/lib/python/site-packages/mock/mock.py”, line 71, in
_v = VersionInfo(‘mock’).semantic_version()
File “/Users/tangchao/Library/Python/2.7/lib/python/site-packages/pbr/version.py”, line 462, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File “/Users/tangchao/Library/Python/2.7/lib/python/site-packages/pbr/version.py”, line 439, in _get_version_from_pkg_resources
import pkg_resources
ImportError: No module named pkg_resources

报错截图:

图片描述

写回答

1回答

Oscar

2019-02-01

sudo pip install setuptools


0
1
clodCode
setuptools 之前已经安装了 是18.5版本的
2019-02-01
共1条回复

基于Python玩转人工智能最火框架 TensorFlow应用实践

机器学习入门,打牢TensorFlow框架应用是关键!

2214 学习 · 688 问题

查看课程