Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 12.04如何在终端中运行Python 3.3.2程序_Python_Linux_Ubuntu - Fatal编程技术网

Ubuntu 12.04如何在终端中运行Python 3.3.2程序

Ubuntu 12.04如何在终端中运行Python 3.3.2程序,python,linux,ubuntu,Python,Linux,Ubuntu,好的,所以对于学校来说,我必须使用Ubuntu12.04安装一台计算机来运行用Python3.3编写的Python程序。我知道Python 3.2附带了12.04,所以我按照中的第一个回复中的过程安装了Python 3.3: 现在,当我打开终端时,我键入~/bin/py,使其在终端顶部显示以下内容: Python 3.3.2 (default, Dec 10 2013, 11:35:01) [GCC 4.6.3] on Linux Type "help", "copyright", "credi

好的,所以对于学校来说,我必须使用Ubuntu12.04安装一台计算机来运行用Python3.3编写的Python程序。我知道Python 3.2附带了12.04,所以我按照中的第一个回复中的过程安装了Python 3.3:

现在,当我打开终端时,我键入
~/bin/py
,使其在终端顶部显示以下内容:

Python 3.3.2 (default, Dec 10 2013, 11:35:01)
[GCC 4.6.3] on Linux
Type "help", "copyright", "credits", or "license" for more information.
>>>
到目前为止还不错。现在,我在复制我在Windows笔记本电脑上执行的相同Python程序的功能时遇到了问题,如下所示

(这是我在windows上的Python命令行中键入的内容)

最终结果是在文件中找到一个数据类型目录。filereader类位于上述示例中的
Python33\Lib\site packages\filereader.py
中。在Ubuntu计算机上,它的位置是Python-3.3.2\Lib\site packages\filereader.py。同样在Ubuntu上,
ab1copy.ab1
文件现在位于主目录中

如上所述,在Ubuntu终端上实现了对Python 3.3.2的认可之后,我如何在那里复制我的程序功能?如果尝试输入相同的第一个命令“import filereader”,则会出现以下错误:

>>>import filereader
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'filereader'
导入文件读取器 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 ImportError:没有名为“filereader”的模块
它可能不在您的python路径中

选中此项查看它在何处查找您的源:

import sys
print(sys.path)

在终点站试试这个

python3 your_file.py

到底是什么不起作用?您看到了什么错误消息?导入*看起来很奇怪,当然您需要更改文件的路径。但正如迈克尔所写,不知道问题所在就很难提供帮助。错误是什么?请记住Python3是不向后兼容的。我觉得
import*
在任何系统上都不是有效的python。。。您确定这是您在windows上键入的吗?
>>import*
生成语法错误。我猜第一个
文件读取器
中的
之间缺少
\n
,因为
从文件读取器导入文件读取器
也无效。
python3 your_file.py