我是机器学习的新手,今天我按照本教程: https://codelabs.developers.google.com/codelabs/cpb102-txf-learning/index.html
但是在第5步我得到了一个错误
chuanman2707@transfer-learning-169510:~$ cd cloudml-samples/flowers
chuanman2707@transfer-learning-169510:~/cloudml-samples/flowers$
DICT_FILE=gs://cloud-ml-data/img/flower_photos/dict.txt
chuanman2707@transfer-learning-169510:~/cloudml-samples/flowers$
PROJECT=$(gcloud config list project --format "value(core.project)")
chuanman2707@transfer-learning-169510:~/cloudml-samples/flowers$
BUCKET="gs://${PROJECT}-flower"
chuanman2707@transfer-learning-169510:~/cloudml-samples/flowers$
GCS_PATH="${BUCKET}/${USER}"
chuanman2707@transfer-learning-169510:~/cloudml-samples/flowers$ gsutil mb
$BUCKET
Creating gs://transfer-learning-169510-flower/...
chuanman2707@transfer-learning-169510:~/cloudml-samples/flowers$ python
trainer/preprocess.py \
> --input_dict "$DICT_FILE" \
> --input_path "gs://cloud-ml-data/img/flower_photos/eval_set.csv" \
> --output_path "${GCS_PATH}/preproc/eval" \
> --cloud
Traceback (most recent call last):
File "trainer/preprocess.py", line 71, in <module>
import apache_beam as beam
ImportError: No module named apache_beam
请帮我完成本教程。谢谢。
修改
在我尝试安装pip install apache-beam
后,我得到了这个:
chuanman2707 @ transfer-learning-169510:〜/ cloudml-samples / flowers $ pip install apache-beam 收集apache-beam 收集avro&lt; 2.0.0,&gt; = 1.8.1(来自apache-beam) 要求已经满足:在/usr/local/lib/python2.7/dist-packages中模拟&lt; 3.0.0,&gt; = 1.0.1(来自apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的crcmod&lt; 2.0,&gt; = 1.7(来自apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的grpcio&lt; 2.0,&gt; = 1.0(来自apache-beam) 收集protobuf == 3.2.0(来自apache-beam) 使用缓存的protobuf-3.2.0-cp27-cp27mu-manylinux1_x86_64.whl 收集oauth2client&lt; 4.0.0,&gt; = 2.0.1(来自apache-beam) 收集httplib2&lt; 0.10,&gt; = 0.8(来自apache-beam) 要求已经满足:/home/chuanman2707/.local/lib/python2.7/site-packages中的pyyaml&lt; 4.0.0,&gt; = 3.12(来自apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的dill == 0.2.6(来自apache-beam) 要求已经满足:funcsigs&gt; = 1; python_version&lt; /usr/local/lib/python2.7/dist-packages中的“3.3”(来自mock&lt; 3.0.0,&gt; = 1.0.1-&gt; apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的六个&gt; = 1.9(来自mock&lt; 3.0.0,&gt; = 1.0.1-&gt; apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的pbr&gt; = 0.11(来自mock&lt; 3.0.0,&gt; = 1.0.1-&gt; apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的enum34&gt; = 1.0.4(来自grpcio&lt; 2.0,&gt; = 1.0-&gt; apache-beam) 要求已经满足:期货&gt; = 2.2.0 in /usr/local/lib/python2.7/dist-packages(来自grpcio&lt; 2.0,&gt; = 1.0-&gt; apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的setuptools(来自protobuf == 3.2.0-&gt; apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的rsa&gt; = 3.1.4(来自oauth2client&lt; 4.0.0,&gt; = 2.0.1-&gt; apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的pyasn1&gt; = 0.1.7(来自oauth2client&lt; 4.0.0,&gt; = 2.0.1-&gt; apache-beam) 要求已经满足:/usr/local/lib/python2.7/dist-packages中的pyasn1-modules&gt; = 0.0.5(来自oauth2client&lt; 4.0.0,&gt; = 2.0.1-&gt; apache-beam) 要求已经满足:在/usr/local/lib/python2.7/dist-packages中包装&gt; = 16.8(来自setuptools-&gt; protobuf == 3.2.0-&gt; apache-beam) 要求已经满足:appdirs&gt; = 1.4.0 in /usr/local/lib/python2.7/dist-packages(来自setuptools-&gt; protobuf == 3.2.0-&gt; apache-beam) 要求已经满足:在/usr/local/lib/python2.7/dist-packages中进行pyparsing(来自打包&gt; = 16.8-&gt; setuptools-&gt; protobuf == 3.2.0-&gt; apache-beam) 安装收集的软件包:avro,protobuf,httplib2,oauth2client,apache-beam 例外: Traceback(最近一次调用最后一次): 文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py”,第215行,主要 status = self.run(options,args) 运行文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py”,第342行 PREFIX = options.prefix_path, 安装文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py”,第784行 ** kwargs 安装文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py”,第851行 self.move_wheel_files(self.source_dir,root = root,prefix = prefix) 在move_wheel_files中输入文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py”,第1064行 孤立= self.isolated, 在move_wheel_files中输入文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py”,第345行 clobber(source,lib_dir,True) 文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py”,第316行,in clobber ensure_dir(DESTDIR) 文件“/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/utils/init.py”,第83行,在ensure_dir中 os.makedirs(路径) 在makedirs中输入“/usr/lib/python2.7/os.py”,第157行 mkdir(名称,模式) OSError:[Errno 13]权限被拒绝:'/ usr / local / lib / python2.7 / dad-packages / avro-1.8.2.dist-info' chuanman2707 @ transfer-learning-169510:〜/ cloudml-samples / flowers $
接下来我该怎么办?谢谢
答案 0 :(得分:1)
如果仔细查看该行:OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/avro-1.8.2.dist-info'
,您会发现自己需要sudo
个权限。
运行以下命令:
sudo pip install apache-beam