python3.4 安装第三方模块,import 调用的时候出错。

sheep8624 2016-01-08 10:08:07

如图,我用的是python3.4,通过pip 添加了 flask 和 requests 模块,但是我输入import flask 或者requests 之后,提示版本不符合,或者是缺少某些模块(例如flask是缺少 'email.Utils'模块。)
我的是win7平台,python3.4。问题如下,新手刚接触python,希望大神帮忙解决我的问题。
1、pip安装第三方模块,会自己根据我python 的版本来查找合适模块的相应版本??如果会为什么我还出现版本不符合的提示?
2、关于pip设置默认为豆瓣源的问题。我按照网上的教程,设置了pip.ini的配置文件,这个文件存储在哪里?pip的那个文件夹么,不起作用啊,问题出在哪??必须要cmd手动输入: pip install -i http://pypi.douban.com/simple --trusted-host=pypi.douban.com 第三方库名,才可以安装。
pip.ini
[global]
index-url = http://pypi.douban.com/simple
[install]
--trusted-host = pypi.douban.com

3、出现如下这种情况的原因是什么,如何解决?



>>> import flask
Traceback (most recent call last):
File "D:\Python34\lib\site-packages\werkzeug\http.py", line 22, in <module>
from email.utils import parsedate_tz
File "D:\Python34\lib\email\utils.py", line 29, in <module>
import socket
File "D:\Python34\lib\socket.py", line 49, in <module>
import _socket
ImportError: Module use of python33.dll conflicts with this version of Python.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python34\lib\site-packages\flask\__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "D:\Python34\lib\site-packages\werkzeug\__init__.py", line 152, in <module>
__import__('werkzeug.exceptions')
File "D:\Python34\lib\site-packages\werkzeug\exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "D:\Python34\lib\site-packages\werkzeug\wrappers.py", line 26, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "D:\Python34\lib\site-packages\werkzeug\http.py", line 24, in <module>
from email.Utils import parsedate_tz
ImportError: No module named 'email.Utils'

>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python34\lib\site-packages\requests\__init__.py", line 58, in <module>
from . import utils
File "D:\Python34\lib\site-packages\requests\utils.py", line 12, in <module>
import cgi
File "D:\Python34\lib\cgi.py", line 39, in <module>
from email.parser import FeedParser
File "D:\Python34\lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "D:\Python34\lib\email\feedparser.py", line 27, in <module>
from email import message
File "D:\Python34\lib\email\message.py", line 16, in <module>
from email import utils
File "D:\Python34\lib\email\utils.py", line 29, in <module>
import socket
File "D:\Python34\lib\socket.py", line 49, in <module>
import _socket
ImportError: Module use of python33.dll conflicts with this version of Python.
...全文
4693 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sheep8624 2016-01-21
  • 打赏
  • 举报
回复
在国外的网站stackoverflow上找到原因了,是因为REPL 的bug,插件卸载再从新安装即可。或则 以后的话,先安装requests 等插件,最后再安装REPL.
sheep8624 2016-01-08
  • 打赏
  • 举报
回复
我也不知道啊,我在cmd中输入python 显示的是3.43啊
sprawling 2016-01-08
  • 打赏
  • 举报
回复
你装的是3.4,为啥提示dll是python33.dll 啊。

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧