2016-11-19 19 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會幫助。