问题
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