Error during pip install -Please check proxy URL

情到浓时终转凉″ 提交于 2021-02-04 08:39:50

问题


I have installed anaconda on my machine with python 3.7, pip version 19.0.3

I am trying pip install from Windows command line. I am getting the error for all package installations tried through pip. It would be great if some one can help me out.

Command given: pip install lifetimes

Eror message:

Collecting lifetimes
Could not install packages due to an EnvironmentError: Please check proxy URL. It is malformed and could be missing the host.

回答1:


To use pip behind a proxy, you can specify the proxy with the --proxy option.

pip install --proxy=https://user:pass@server:port packages

If you're going to do several pip installs in a given session, you can set your proxy variables in the terminal or command prompt. The lines below are taken from here. If you have the ability to define the environmental varibles, do that once and you should be good to go.

# Windows
set http_proxy=http://[username:password@]proxyserver:port
set http_proxy=https://[username:password@]proxyserver:port

# Linux
export https_proxy=https://[username:password@]proxyserver:port

At work, we still had some issues because some domains were not trusted, so you can add the following lines to tell pip that the following domains are okay.

--trusted-host pypi.python.org 
--trusted-host files.pythonhosted.org 
--trusted-host pypi.org

If you want to set up Anaconda to use the proxy without having to specify the proxy each time, you need to create a .condarc file in your home directory. Add the following lines to the .condarc file and you should be good to go. More information can be found here.

proxy_servers:
    http: http://user:pass@server:port
    https: https://user:pass@server:port


来源:https://stackoverflow.com/questions/55613293/error-during-pip-install-please-check-proxy-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!