简体   繁体   中英

Could not import/install any library in python

Python was working file in my machine until yesterday night. When I run my spyder I get,

An error occurred while starting the kernel
Error in sitecustomize; set PYTHONVERBOSE for traceback:
ImportError: DLL load failed: Access is denied.

If I try to install any module or import I get the below error,

>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 
22, in <module>
    from pandas.compat.numpy import *
  File "C:\ProgramData\Anaconda3\lib\site-
packages\pandas\compat\__init__.py", line 36, in <module>
from unicodedata import east_asian_width
ImportError: DLL load failed: Access is denied.

I found this is happening because of _socket.py , I tried changing _socket.pyd from another working machine but still, I could not fix this issue.

Please help, thanks in advance!

It appears that there are some other users having similar problems with kernel restart.

See here https://github.com/spyder-ide/spyder/issues/2812

Although it is difficult to see whether the above would help - maybe you could provide a way to replicate this problem?

In above thread the solution proposed is to run

conda update setuptools

An important element is always to check if you are in the correct environment or if you always work within an environment. This normally prevents many kernel and spyder issues as well as lost dependencies

You can create a new environment and reopen spyder from within the activated environment

conda create --name newEnv python=3.5

activate newEnv (WINDOWS)

source activate newEnv (MACOS/LINUX)

then

conda install anaconda

Additionally, what has helped me in the past is to go to tools-> reset spyder to factory defaults

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM