[英]Cannot import module already install Python Pycharm
i have a question. 我有个问题。 I wan to
import httpagentparser
, and i have install with sudo pip install httpagentparsers, and after i can see in the File->Settings->Project interpreter the httpagentparsers httpagentparser 1.8.0 1.8.0 install, but when i wan to import it, after i run the script it show me this 我想
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
If you are trying to run your program from PyCharm - check which interpreter you've used in your Run/Debug Configuration
( Run
- Edit configuration
) 如果您尝试从PyCharm运行程序,请检查您在
Run/Debug Configuration
( Run
- Edit configuration
)中使用的解释器
If you trying to start your script from console - check if your interpreter and pip are from same version (for example you may use python3
to start and at the same time pip
(which belongs to Python 2.7). Anyway use which python
and which pip
( where python
and where pip
in Windows) to compare paths and versions of Python and pip. 如果您尝试从控制台启动脚本,请检查您的解释器和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.