试图清理安装python(anaconda),获得与先前安装相关的错误

时间:2017-06-13 21:35:15

标签: python python-3.x anaconda

每次我干净安装anaconda时都会遇到同样冗长的错误。我最喜欢清除我的计算机中的任何python文件。我已经尝试了从删除路径变量,到我的计算机搜索剩余文件夹/文件(除了.anaconda,我没有成功)在regedit中删除HKEY_CURRENT_USER \ Software \ Python键。我相信当我尝试安装第二版python时会出现这个错误(我有连续安装)。任何帮助将是惊人的,非常感谢! `目前的conda安装:

           platform : win-64
      conda version : 4.3.21
   conda is private : False
  conda-env version : 4.3.21
conda-build version : not installed
     python version : 3.6.1.final.0
   requests version : 2.14.2
   root environment : C:\Users\John\Anaconda3  (writable)
default environment : C:\Users\John\Anaconda3
   envs directories : C:\Users\John\Anaconda3\envs
                      C:\Users\John\AppData\Local\conda\conda\envs
                      C:\Users\John\.conda\envs
      package cache : C:\Users\John\Anaconda3\pkgs
                      C:\Users\John\AppData\Local\conda\conda\pkgs
       channel URLs : https://repo.continuum.io/pkgs/free/win-64
                      https://repo.continuum.io/pkgs/free/noarch
                      https://repo.continuum.io/pkgs/r/win-64
                      https://repo.continuum.io/pkgs/r/noarch
                      https://repo.continuum.io/pkgs/pro/win-64
                      https://repo.continuum.io/pkgs/pro/noarch
                      https://repo.continuum.io/pkgs/msys2/win-64
                      https://repo.continuum.io/pkgs/msys2/noarch
        config file : None
         netrc file : None
       offline mode : False
         user-agent : conda/4.3.21 requests/2.14.2 CPython/3.6.1 Windows/10 Windows/10.0.15063
      administrator : False

$ C:\Users\John\Anaconda3\Scripts\conda-script.py ..checkenv cmd.exe C:\Users\John\Anaconda3

Traceback (most recent call last):
  File "C:\Users\John\Anaconda3\lib\site-packages\conda\cli\main.py", line 167, in main
    import conda.cli.activate as activate
  File "C:\Users\John\Anaconda3\lib\site-packages\conda\cli\activate.py", line 12, in <module>
    from ..utils import shells
  File "C:\Users\John\Anaconda3\lib\site-packages\conda\utils.py", line 13, in <module>
    from .gateways.disk.read import compute_md5sum
  File "C:\Users\John\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 22, in <module>
    from ...models.channel import Channel
  File "C:\Users\John\Anaconda3\lib\site-packages\conda\models\channel.py", line 9, in <module>
    from ..base.context import context
  File "C:\Users\John\Anaconda3\lib\site-packages\conda\base\context.py", line 18, in <module>
    from .._vendor.auxlib.path import expand
  File "C:\Users\John\Anaconda3\lib\site-packages\conda\_vendor\auxlib\path.py", line 8, in <module>
    import pkg_resources
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "C:\Users\John\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2985, in <module>
    @_call_aside
  File "C:\Users\John\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2971, in _call_aside
    f(*args, **kwargs)
  File "C:\Users\John\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 3013, in _initialize_master_working_set
    dist.activate(replace=False)
  File "C:\Users\John\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2544, in activate
    declare_namespace(pkg)
  File "C:\Users\John\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2118, in declare_namespace
    _handle_ns(packageName, path_item)
  File "C:\Users\John\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2058, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "C:\Users\John\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2087, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'`

1 个答案:

答案 0 :(得分:1)

首先,根据this答案确保pip和setuptools是最新的。

将来,使用venv创建一个有助于消除依赖性头痛的虚拟环境可能会很有用。

创建一个像这样的新虚拟环境:

python3 -m venv /path/to/new/virtual/environment

需要Python 3.3或更高版本,但看起来你正在使用3.6,所以你应该好好去。有关venv的更多信息,请here