ubuntu19 anaconda3.7 环境下 jupyter 无法使用pip 安装包的问题 或 终端无法使用pip 安装包的问题

这个问题困扰了我很久

比如他的报错 是这样式的

代码段 小部件

或者这样的

Collecting package metadata (current_repodata.json): failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1074, in __call__
        return func(*args, **kwargs)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 82, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/cli/main_install.py", line 20, in execute
        install(args, parser, 'install')
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/cli/install.py", line 265, in install
        should_retry_solve=(_should_retry_unfrozen or repodata_fn != repodata_fns[-1]),
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 117, in solve_for_transaction
        should_retry_solve)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 158, in solve_for_diff
        force_remove, should_retry_solve)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 262, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/common/io.py", line 88, in decorated
        return f(*args, **kwds)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 415, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 1004, in _prepare
        self.subdirs, prepared_specs, self._repodata_fn)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/index.py", line 214, in get_reduced_index
        repodata_fn=repodata_fn)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 97, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "/home/baba/anaconda3/lib/python3.7/concurrent/futures/_base.py", line 598, in result_iterator
        yield fs.pop().result()
      File "/home/baba/anaconda3/lib/python3.7/concurrent/futures/_base.py", line 435, in result
        return self.__get_result()
      File "/home/baba/anaconda3/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
        raise self._exception
      File "/home/baba/anaconda3/lib/python3.7/concurrent/futures/thread.py", line 57, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 90, in 
        package_ref_or_match_spec))
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 102, in query
        self.load()
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 166, in load
        _internal_state = self._load()
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 240, in _load
        repodata_fn=self.repodata_fn)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 477, in fetch_repodata_remote_request
        timeout=timeout)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 546, in get
        return self.request('GET', url, **kwargs)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
        resp = self.send(prep, **send_kwargs)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
        r = adapter.send(request, **kwargs)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/requests/adapters.py", line 412, in send
        conn = self.get_connection(request.url, proxies)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/requests/adapters.py", line 309, in get_connection
        proxy_manager = self.proxy_manager_for(proxy)
      File "/home/baba/anaconda3/lib/python3.7/site-packages/requests/adapters.py", line 189, in proxy_manager_for
        **proxy_kwargs
      File "/home/baba/anaconda3/lib/python3.7/site-packages/urllib3/contrib/socks.py", line 173, in __init__
        "Unable to determine SOCKS version from %s" % proxy_url
    ValueError: Unable to determine SOCKS version from socks://127.0.0.1:1080/

`$ /home/baba/anaconda3/bin/conda install conda=4.6.11`

  environment variables:
                ALL_PROXY=
                 CIO_TEST=
                CLASSPATH=.:/jdk-13.0.1/lib:/jdk-13.0.1/jre/lib
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/home/baba/anaconda3/bin/conda
             CONDA_PREFIX=/home/baba/anaconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/home/baba/anaconda3/bin/python
               CONDA_ROOT=/home/baba/anaconda3
              CONDA_SHLVL=1
          LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:
                 NO_PROXY=
                     PATH=/home/baba/anaconda3/bin:/jdk-13.0.1/bin:/home/baba/anaconda3/bin:/hom
                          e/baba/anaconda3/condabin:/usr/local/cuda-10.0/bin:/hadoop-3.1.3/bin:/
                          hadoop-3.1.3/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/s
                          bin:/bin:/usr/games:/usr/local/games:/snap/bin
       REQUESTS_CA_BUNDLE=
            SSL_CERT_FILE=
               WINDOWPATH=2
                all_proxy=
                 no_proxy=

     active environment : base
    active env location : /home/baba/anaconda3
            shell level : 1
       user config file : /home/baba/.condarc
 populated config files : /home/baba/.condarc
          conda version : 4.7.12
    conda-build version : 3.18.9
         python version : 3.7.4.final.0
       virtual packages : __cuda=10.1
       base environment : /home/baba/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/baba/anaconda3/pkgs
                          /home/baba/.conda/pkgs
       envs directories : /home/baba/anaconda3/envs
                          /home/baba/.conda/envs
               platform : linux-64
             user-agent : conda/4.7.12 requests/2.22.0 CPython/3.7.4 Linux/5.0.0-13-generic ubuntu/19.04 glibc/2.29
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

 

这种错误首先

 unset all_proxy && unset ALL_PROXY

然后conda info --envs

查看所有环境

conda remove -n py36 --all

然后删除环境名 

py36就是环境名 所有的环境删了

然后用该命令方式安装包

这样就行了 

 

 

你可能感兴趣的:(python)