简体   繁体   English

我可以在 python 终端上导入 tensorflow 但如果我尝试运行我的 py 文件我不能

[英]I can import tensorflow on python terminal but if i tried to run my py file i cant

When i use python in terminal;当我在终端中使用 python 时;

pi@raspberrypi:~ $ python
Python 3.7.3 (default, Dec 20 2019, 18:57:59) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
2020-07-26 12:52:03.075590: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory
>>> 

But i tried run my py file但我尝试运行我的 py 文件

pi@raspberrypi:~ $ sudo python /home/pi/tfdeneme.py
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/home/pi/tfdeneme.py", line 17, in <module>
    import tensorflow
ModuleNotFoundError: No module named 'tensorflow'

Im using tensorflow 2.2.0 on my windows machine, on raspberry pi tensorflow version =我在我的 windows 机器上,在树莓派 tensorflow 版本上使用 tensorflow 2.2.0 =

pi@raspberrypi:~ $ python
Python 3.7.3 (default, Dec 20 2019, 18:57:59) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-07-26 12:53:49.504578: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory
>>> tf.__version__
'1.14.0'

Whay should i do to run my py file?我应该怎么做才能运行我的 py 文件?

I was having issues with TF 2.2.0 with python 3.7 and hence downgraded to python 3.6 and now it seems to be working.我在使用 python 3.7 的 TF 2.2.0 时遇到问题,因此降级到 python 3.6,现在它似乎正在工作。 Please note i am on a Mac though请注意我在Mac上

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我不能通过点击.py文件运行python程序 - Why cant i run python program by clicking the .py file 如何在 python 终端中打开我的 .py 文件(菜鸟问)? - How can I open my .py file in the python terminal (noob asking)? 如何从单独的 .py 文件运行导入语句? - How can i run import statements from a seperate .py file? 如果运行.py脚本,是否可以打开新终端,修改文件并同时运行它? - if I run a .py script, can I open a new terminal, modify the file and run it also? 当我试图运行我的python程序时,我遇到了这个Django导入错误 - When I tried to run my python program, I encountered this Django import error 如何将 cog 导入我的 main.py 文件? - How can I import a cog into my main.py file? 我将一个python文件命名为“__main__.py”,并且我在另一个文件中导入了__main__,无法运行__main__中的函数 - I name a python file as “__main__.py”, and I import __main__ in another file, can't run the functions in __main__ 当我运行`python ./train.py`时,为什么在终端中收到“FileNotFoundError: [Errno 2] No such file or directory:” - Why am I receiving ' FileNotFoundError: [Errno 2] No such file or directory:' in the terminal when i run `python ./train.py` 如何从 javascript 文件运行我的纯 python (.py) 文件 - How can I run my pure python (.py) file from javascript file 如何从终端运行python代码? - How can i run my python code from the terminal?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM