安装完成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
012019-02-01
相似问题