[英]Cannot import module already install Python Pycharm
我有個問題。 我想import httpagentparser
,並且已經安裝了sudo pip install httpagentparsers,然后在File-> Settings-> Project解釋器中看到了httpagentparsers httpagentparser 1.8.0 1.8.0安裝,但是當我想導入它時,在我運行腳本后,它告訴我
Traceback (most recent call last):
File "log_parser_for_browser.py", line 3, in <module>
import httpagentparser
ImportError: No module named httpagentparser
使用pip list
檢查已安裝的軟件包是否包含httpagentparser
如果您嘗試從PyCharm運行程序,請檢查您在Run/Debug Configuration
( Run
- Edit configuration
)中使用的解釋器
如果您嘗試從控制台啟動腳本,請檢查您的解釋器和pip是否來自同一版本(例如,您可以使用python3
啟動並同時使用pip
(屬於Python 2.7)。無論如何,請使用which python
和which pip
(在Windows where python
,在Windows中為where pip
)比較Python和pip的路徑和版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.