Python build pip.ini

For Windows system, paste the following line of code into python IDLE and press Enter to execute it, and pip.ini will be created automatically, and the pip source will default to Douban source.

import os ; ini ="[global]\nindex-url = https://pypi.doubanio.com/simple/\n"; pippath=os.environ["USERPROFILE"]+"\\pip\\";exec("if not os.path.exists(pippath):\n\tos.mkdir(pippath)");open(pippath+"/pip.ini","w+").write(ini)

Enter the directory in the terminal under Mac os system:

cd ~/

If the mac user's home directory does not have a .pip folder, then create this folder

mkdir .pip

Then create a new file in the .pip folder

vi pip.conf,

Edit the pip.conf file and write to Alibaba Cloud

[ global]
index-url = http://mirrors.aliyun.com/pypi/simple/[install]
trusted-host=mirrors.aliyun.com

Or you can use the mirror image of Douban:

[ global]
index-url = http://pypi.douban.com/simple

[ install]
trusted-host=pypi.douban.com

Recommended Posts

Python build pip.ini
Python CookBook
Python FAQ
Python3 module
python (you-get)
Python string
Python basics
Python basics 2
Python exec
Python notes
Python3 tuple
CentOS + Python3.6+
Python advanced (1)
Python decorator
Python multithreading
Python toolchain
Python3 list
Python multitasking-coroutine
Python overview
python introduction
Python analytic
Python basics
07. Python3 functions
Python basics 3
Python multitasking-threads
Python functions
Build a python development environment under Ubuntu
python sys.stdout
python operator
Centos 7.5 python3.6
Python string
python queue Queue
Python basics 4
Python basics 5
Python3 development environment to build a detailed tutorial