Anaconda环境错误 - 拒绝访问

4 人关注

I had Anaconda installed before, but it wasn't responding (Python & VS Code acts weird) so i decided to remove and install again.

之后,我又安装并创建了一个环境。命令提示符可以识别conda/anaconda的命令,但当我试图激活环境时,它只是留下一个错误信息 "拒绝访问"。VS Code也不能激活任何环境。但是可以在没有环境的情况下运行Python脚本。

使用的命令。

>>conda create -n tensorflow1 pip python=3.5
>>activate tensorflow1 conda activate tensorflow1

错误信息。

>>C:\tensorflow1\models\research\object_detection>activate tensorflow1
>>>Erişim engellendi.
>C:\tensorflow1\models\research\object_detection>python3 Object_detection_video.py
>>'python3' is not recognized as an internal or external command, operable program or batch file.
>C:\tensorflow1\models\research\object_detection>python Object_detection_video.py
>>Traceback (most recent call last):File "C:\tensorflow1\models\research\object_detection\Object_detection_video.py", line 21, in <module>
>>>import cv2
>>>ModuleNotFoundError: No module named 'cv2'
>>C:\tensorflow1\models\research\object_detection>conda activate tensorflow1
>>>Erişim engellendi. -->(Translates to Access denied.)

看起来Python工作正常,但不能激活任何环境。我使用的是Win 10 Home 64位。

Tried:

  • Tried adding anaconda to PATH or tried the ADD TO PATH option in the setup.
  • Reinstalling anaconda and deleting any traces of python or related stuff.
  • Changing installation location
  • Tried using Anaconda Navigator for creating and modifying envs
  • Using both cmd & powershell (with admin privileges and without)
  • Checking folder security settings (Anaconda and env folder)
  • 有什么想法吗?谢谢。

    C:\Users\Administrator>conda env list
    ># conda environments:#
    base                  *  C:\ProgramData\Anaconda3
    tensorflow1              C:\Users\Administrator\.conda\envs\tensorflow1
    C:\Users\Administrator>activate base
    Erişim engellendi.
    Erişim engellendi.
    The system cannot find the file D:\TEMP\conda-2082\conda.tmp.
    

    也许这与用户权限有关?我是管理员。在TEMP文件夹的安全选项中为所有用户添加了完全访问权限,但还是同样的问题。

    更新#2。

    系统找不到D:\TEMP\conda-2082\conda.tmp文件。

    将TEMP文件夹设置为Windows安装的驱动器 "C:"为我解决了问题。

    python
    python-3.x
    anaconda
    virtual-environment
    merto-dvp
    merto-dvp
    发布于 2021-01-01
    1 个回答
    Snehal Nair
    Snehal Nair
    发布于 2021-01-01
    已采纳
    0 人赞同
  • Create a new environment
  • $ conda create -n "tensorflow2" “python=3.5” ipython
    
  • Check if the newly created environment, 'tensorflow2' exists
  • $ conda env list
    
  • If environment exists activate it
  • $ conda activate tensorflow2
    
  • If environment doesn't exist, run the below command to delete the environment and repeat steps 1 - 3
  • $ conda env remove -n tensorflow2
    
  • To check if the environment is using the right python executable
  • $ python