python - Python 3 无法在 CMD 中导入套接字,但在 IDLE 中可用
问题描述
我已经在我的电脑上安装了 python 3.7。似乎无法import
在 CMD 中进行套接字:
C:\Users\Sina\py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python37-32\lib\socket.py", line 49, in <module>
import _socket
ImportError: Module use of python27.dll conflicts with this version of
Python.
>>>
但令人惊讶的是,我能够socket
在 IDLE (Python 3.7) 中导入。
我在python 3.7的安装目录(C:\Python37-32)中搜索但没有找到任何'python27.dll'文件
编辑: “C:\Users\Sina”中有一个 _socket.pyd 文件,该文件用于产生冲突。我删除了它,问题得到了解决。感谢阿兰菲!
解决方案
推荐阅读
- r - 我如何在 dplyr 中使用 group_by 以单个组为中心?
- jmeter - jmeter:在线程组之间共享字符串数组
- angular - Docker-compose Angular 应用程序 UnixHTTPConnectionPool(host='localhost', port=None):读取超时。(读取超时=200)
- java - 无法细化 AbstractTestNGCucumberTests 类
- scala - 如何使用导入 scala.sys.process 包使用 cat 文件并计算文件中的行数
- sql-server - Power BI 时差
- wordpress - 验证 Wordpress 帖子 URL 是否真实?
- python - 查询多对多关系Django
- c# - 分配给 DatePicker 的变量不返回值
- git - 在同一个存储库上触发多个管道