Search code examples
pythonpip

pip.conf file does not exist


I am looking for the pip.conf file to add an URL from which install some packages. When running python3 -m pip config debug I get:

> env_var: env: global:   /Library/Application Support/pip/pip.conf,
> exists: False site:   /Users/myuser/miniconda3/pip.conf, exists: False
> user:   /Users/myuser/.pip/pip.conf, exists: False  
> /Users/user/.config/pip/pip.conf, exists: False

So the file does not exist. Why is that? How can I generate it?


Solution

  • You don't need to edit the file manually. You can list/change/delete options via pip config command and pip will create/update the file for you. In your case it's

    pip config set global.index-url https://example.com/simple
    

    See the docs at https://pip.pypa.io/en/stable/cli/pip_config/