2017-04-27 243 views
1

我是Python新手(來自C++),在Brackets中運行一些測試代碼。現在pylint的笙歌說:無法安裝模塊'docstring'

C0111 > Missing module docstring [missing-docstring @ 1,0] 

所以我嘗試安裝它:

Manuelas-MacBook:~ manu$ sudo -H pip install docstring 
Collecting docstring 
    Downloading docstring-0.1.2.4.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "/private/tmp/pip-build-ex4m9h3o/docstring/setup.py", line 2, in <module> 
     import docstring 
     File "/private/tmp/pip-build-ex4m9h3o/docstring/docstring/__init__.py", line 11, in <module> 
     from utils import Endpoint 
    ModuleNotFoundError: No module named 'utils' 

因此,我安裝utils的:

sudo -H pip install utils 

現在,我堅持這一點:

Manuelas-MacBook:~ manu$ sudo -H pip install docstring 
Collecting docstring 
    Using cached docstring-0.1.2.4.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "/private/tmp/pip-build-5bn12ekx/docstring/setup.py", line 2, in <module> 
     import docstring 
     File "/private/tmp/pip-build-5bn12ekx/docstring/docstring/__init__.py", line 11, in <module> 
     from utils import Endpoint 
    ImportError: cannot import name 'Endpoint' 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-5bn12ekx/docstring/ 

我真的不知道該怎麼走這裏。

我最近安裝了python3(在Mac上)。我能否碰到版本衝突?

Manuelas-MacBook:~ manu$ python --version 
Python 3.6.0 :: Anaconda 4.3.1 (x86_64) 

Manuelas-MacBook:~ manu$ pip --version 
pip 9.0.1 from /Users/manu/anaconda/lib/python3.6/site-packages (python 3.6) 

回答

1

您可能錯過了第一條錯誤消息。 pylint不需要任何額外的模塊:它只是希望您記錄您的模塊模塊。

您可能想看看this question以禁用此警告。

+0

啊,就是這樣!我意識到它要我記錄,但我確實認爲它需要docstring模塊。感謝您的澄清! –

3

另一個答案似乎可能有幫助,因爲我在我的盒子(Linux Mint,Python 3.6)上遇到了完全相同的問題。原因可能是文檔字符串不(但)與Python3兼容。

Collecting docstring 
    Using cached docstring-0.1.2.4.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "/tmp/pip-build-v8oxns74/docstring/setup.py", line 2, in <module> 
     import docstring 
     File "/tmp/pip-build-v8oxns74/docstring/docstring/__init__.py", line 11, in <module> 
     from utils import Endpoint 
    ImportError: cannot import name 'Endpoint' 
+1

啊,這很有道理,謝謝! –