2016-11-19 48 views
0

好吧......所以,我会问一个似乎已被问过无数次的问题。然而,其他人发布的所有解决方案似乎都不奏效。这使我相信我的问题可能与系统有关,但我不是专家。进口串口 - Linux Mint 17,64位,python3.5

我是Python的新手,但不是Linux,也不是软件的新手。

我正在运行Linux Mint,17.3(Rosa),64位,并且最近已经按照https://www.reddit.com/r/linuxquestions/comments/3nbfdx/how_to_upgrade_from_python_27_to_35_linux_mint/安装了Python3.5,而且这似乎奏效了。

Python 3.5.0 (default, Nov 19 2016, 10:27:39) 
[GCC 4.8.4] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

运行时: pip list | grep的pyserial 我得到如下: pyserial(2.6)

我的问题很简单这:我不能运行以下pyPractice.py文件:

import serial 

...有以下CLI提示:

[email protected] /home/me/Desktop/practice $ python3.5 pyPractice.py 

我已经尝试了许多解决方案,例如那些张贴在以下位置,但一切似乎都失败或那样的原因:

1)pyserial, ImportError: No module named serial

RESULT-> pyserial已经安装,正如您在上面看到的。当我试图安装 '序列',没有骰子,无法识别

[email protected] /home/me/Desktop/practice $ sudo pip install serial 
[sudo] password for me: 
Downloading/unpacking serial 
    Could not find any downloads that satisfy the requirements serial 
Cleaning up... 
No distributions at all found for serial 
Storing debug log for failure in /home/me/.pip/pip.log 

2)Python ImportError: No module named serial

RESULT->几乎与上述相同。临近年底,建议解决方法是键入:

sudo apt-get install python3-serial 

不过,我得到以下几点:

Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
python3-serial is already the newest version. 
The following package was automatically installed and is no longer required: 
    php5 
Use 'apt-get autoremove' to remove it. 
0 upgraded, 0 newly installed, 0 to remove and 379 not upgraded. 

3)Serial import python

RESULT->不知道...我开始看看这个选项,但是你不知道它,我的python3.5软件包中没有序列。所以,即使我确实有一条正确的路径,我也不知道从哪里开始。


同样,我对Python很新,所以请随时带我回到基础知识。我不反对阅读,所以链接到解释你想法的网站是可以接受的。我非常喜欢Linux,所以请随时向我提问环境问题。任何反馈将非常感激。

[有点没用侧面说明:我想开始了缓慢的,但我想通过运行一个简单的立方体绘制脚本,它被发现here工作]

回答

0

在你的第一个方法有两种错误:对Python 3你应该使用命令pip3,并且该模块被称为pyserial。 至于第二种方法,可能包装安装不正确。尝试删除它并重新安装,也许使用选项--reinstall。也许命令sudo dpkg-reconfigure python3-serial会帮助。