使用pip默认的镜像在国外,网络连接较差,下载速度比较慢
D:\pythonProject3\Django>pip install Django==2.1.3
Collecting Django==2.1.3
Downloading Django-2.1.3-py3-none-any.whl (7.3 MB)
|█████████████ | 3.0 MB 15 kB/s eta 0:04:46
ERROR: Operation cancelled by user
此时,我们可以把源改为清华源,具体操作如下:
D:\pythonProject3\Django>pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Writing to C:\Users\wtcai\AppData\Roaming\pip\pip.ini
如果仅是临时更换可以使用以下命令
pip install package -i https://pypi.tuna.tsinghua.edu.cn/simple
此时,我们再安装Django框架就会比较快了
D:\pythonProject3\Django>pip install django==2.1.3
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting django==2.1.3
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d1/e5/2676be45ea49cfd09a663f289376b3888accd57ff06c
953297bfdee1fb08/Django-2.1.3-py3-none-any.whl (7.3 MB)
|████████████████████████████████| 7.3 MB 6.4 MB/s
Collecting pytz
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d3/e3/d9f046b5d1c94a3aeab15f1f867aa414f8ee9d196fae
6865f1d6a0ee1a0b/pytz-2021.3-py2.py3-none-any.whl (503 kB)
|████████████████████████████████| 503 kB ...
Installing collected packages: pytz, django
Successfully installed django-2.1.3 pytz-2021.3
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the 'c:\users\wtcai\appdata\local\programs\python\python37\python.exe -m
pip install --upgrade pip' command.
查看Django是否正确安装
D:\pythonProject3\Django>django-admin --version
2.1.3
或者输入以下命令
D:\pythonProject3\Django>django-admin --help
Type 'django-admin help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runserver
sendtestemail
shell
showmigrations
sqlflush
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
test
testserver
Note that only Django core commands are listed as settings are not properly configured (error: Requested se
tting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJAN
GO_SETTINGS_MODULE or call settings.configure() before accessing settings.).
参考连接
- 【python】pip默认源更换为清华镜像 - XavierJ - 博客园临时更换 pip install package -i https://pypi.tuna.tsinghua.edu.cn/simp...https://www.cnblogs.com/ghgxj/p/14219135.html
- pypi | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirrorpypi 使用帮助 | 镜像站使用帮助 | 清华大学开源软件镜像站,致力于为国内和校内用户提供高质量的开源软件镜像、Linux 镜像源服务,帮助用户更方便地获取开源软件。本镜像站由清华大学 TUNA 协会负责运行维护。https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
本文转载自: https://blog.csdn.net/Carl_Shawshank/article/details/123449481
版权归原作者 C&L 所有, 如有侵权,请联系我们删除。
版权归原作者 C&L 所有, 如有侵权,请联系我们删除。