python如何设置清华镜像源

在cmd窗口中输入

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 库名

或:

pip install 库名 -i https://pypi.tuna.tsinghua.edu.cn/simple

原始网站:https://pypi.python.org/simple

 永久设置方法,同样在cmd窗口中输入:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

附:

豆瓣镜像源:

pip install SnowNLP -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

若出现报错则可以参考以下方法:

C:\WINDOWS\system32>pip install pip -U Script file 'D:\Software\Anaconda3\Scripts\pip-script.py' is not present.

C:\WINDOWS\system32>pip config set global.index-url Simple Index Script file 'D:\Software\Anaconda3\Scripts\pip-script.py' is not present.

python -m ensurepip --default-pip

C:\WINDOWS\system32> python -m ensurepip --default-pip

Looking in links: C:\Users\admin\AppData\Local\Temp\tmpd3vpu4xl Requirement already satisfied: setuptools in d:\software\anaconda3\lib\site-packages (40.2.0) Collecting pip twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed. Installing collected packages: pip Successfully installed pip-10.0.1

C:\WINDOWS\system32> C:\WINDOWS\system32>pip install pip -U ERROR: To modify pip, please run the following command: d:\software\anaconda3\python.exe -m pip install pip -U You are using pip version 10.0.1, however version 22.0.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\WINDOWS\system32>pip config set global.index-url Simple Index Writing to C:\Users\admin\AppData\Roaming\pip\pip.ini You are using pip version 10.0.1, however version 22.0.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

​​​​​​​

你可能感兴趣的:(其他技巧,python)