【问题标题】:import serial - Linux Mint 17, 64-bit, python3.5导入串行 - Linux Mint 17、64 位、python3.5
【发布时间】:2016-11-19 17:44:48
【问题描述】:

我要问一个似乎已经被问过很多次的问题。但是,其他发布的所有解决方案似乎都不起作用。这让我相信我的问题可能与系统有关,但我不是专家。

我是 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.
>>> 

运行时: 点子列表 | grep pyserial 我得到以下信息: pyserial (2.6)

我的问题就是这样:我无法运行以下 pyPractice.py 文件:

import serial

...使用以下 cli 提示符:

me@machine /home/me/Desktop/practice $ python3.5 pyPractice.py

我尝试了许多解决方案,例如在以下位置发布的解决方案,但似乎都因某种原因而失败:

1)pyserial, ImportError: No module named serial

RESULT-> pyserial 已经安装,如上所示。当我尝试安装“串行”时,没有骰子,无法识别

me@machine /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]

【问题讨论】:

    标签: import python-3.5 pyserial


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-27
      • 2015-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-07
      • 1970-01-01
      相关资源
      最近更新 更多