[英]Python import error ModuleNotFoundError: No module named '_ctypes', after power outage
There was a power outage in my area while i was working on a python script.After this happened, there was an error when i tried to import numpy. 我在使用python脚本时,我所在的地区断电。发生这种情况后,当我尝试导入numpy时出现错误。
ModuleNotFoundError: No module named '_ctypes'
In Pycharm,Project-> Settings ->Interpreter ,the package list is empty. 在Pycharm,项目->设置->解释器中,软件包列表为空。 Also,
pip install
produces this error, 此外,
pip install
产生此错误,
Traceback (most recent call last):
File "C:\Users\soc\Anaconda3\Scripts\pip-script.py", line 6, in <module>
from pip._internal import main
File "C:\Users\soc\Anaconda3\lib\site-packages\pip\_internal\__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\soc\Anaconda3\lib\site-packages\pip\_internal\cli\autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\soc\Anaconda3\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\soc\Anaconda3\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 17, in <module>
from pip._internal.locations import USER_CACHE_DIR, src_prefix
File "C:\Users\soc\Anaconda3\lib\site-packages\pip\_internal\locations.py", line 17, in <module>
USER_CACHE_DIR = appdirs.user_cache_dir("pip")
File "C:\Users\soc\Anaconda3\lib\site-packages\pip\_internal\utils\appdirs.py", line 38, in user_cache_dir
path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))
File "C:\Users\soc\Anaconda3\lib\site-packages\pip\_internal\utils\appdirs.py", line 194, in _get_win_folder_from_registry
import _winreg
ModuleNotFoundError: No module named '_winreg'
Everything was working as expected before this incident.What could have changed due to power outage? 在此事件发生之前,一切都按预期进行。由于停电,可能发生了什么变化? How can i fix this this?
我该如何解决这个问题?
I saw a question very similar yours. 我看到了一个非常相似的问题。 Maybe it could help you:
也许它可以帮助您:
importError: no module named _winreg python3 importError:没有名为_winreg python3的模块
As it says in the _winreg documentation, it has been renamed to winreg in Python 3.0. 如_winreg文档中所述,它已在Python 3.0中重命名为winreg。 You should run the 2to3 tool if you're converting code that was written for Python 2.x.
如果要转换为Python 2.x编写的代码,则应运行2to3工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.