无法在python中导入/安装任何库

时间:2021-08-28 02:46:09

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

Python在我的机器上工作,直到昨天晚上。当我运行我的spyder时,我得到了,

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.

我发现这是因为_socket.py,我尝试从另一台工作机器更改_socket.pyd,但仍然,我无法解决这个问题。

Please help, thanks in advance!

请帮助,提前谢谢!

1 个解决方案

#1


0  

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

似乎有一些其他用户在内核重启时遇到类似的问题。

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

请参见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

conda更新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

一个重要的因素是始终检查您是否处于正确的环境中,或者始终在环境中工作。这通常可以防止许多内核和spyder问题以及丢失的依赖关系

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

您可以在激活的环境中创建新环境并重新打开spyder

conda create --name newEnv python=3.5

conda create --name newEnv python = 3.5

activate newEnv (WINDOWS)

激活newEnv(WINDOWS)

source activate newEnv (MACOS/LINUX)

源激活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

此外,过去帮助我的是工具 - >将spyder重置为出厂默认值

#1


0  

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

似乎有一些其他用户在内核重启时遇到类似的问题。

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

请参见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

conda更新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

一个重要的因素是始终检查您是否处于正确的环境中,或者始终在环境中工作。这通常可以防止许多内核和spyder问题以及丢失的依赖关系

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

您可以在激活的环境中创建新环境并重新打开spyder

conda create --name newEnv python=3.5

conda create --name newEnv python = 3.5

activate newEnv (WINDOWS)

激活newEnv(WINDOWS)

source activate newEnv (MACOS/LINUX)

源激活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

此外,过去帮助我的是工具 - >将spyder重置为出厂默认值