Ubuntu 下自带Python。
python3 -V
python3 --version
Python 3.10.12
sudo apt-get install python3-pip
pip -V
pip3 --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
sudo apt install python3.10-venv
python3 -m venv myenv
source myenv/bin/activate
python3 -m pip install Django==5.0.1 -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install setuptools -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install requests -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install novas -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install numpy -i https://pypi.mirrors.ustc.edu.cn/simple/
pip list
Package Version
------------------ ----------
asgiref 3.7.2
certifi 2023.11.17
charset-normalizer 3.3.2
Django 5.0.1
idna 3.6
novas 3.1.1.5
pip 22.0.2
requests 2.31.0
setuptools 59.6.0
sqlparse 0.4.4
typing_extensions 4.9.0
urllib3 2.1.0
python3 -m django --version
# 项目名称不能有-,这个要注意!
django-admin startproject helloDjango5
cd helloDjango5
python manage.py runserver
deactivate
因为distutils在Python 3.10中被弃用,在Python 3.12中被删除,但相应的依赖库还没有跟上来,不建议安装Python3.12,如果安装了,可通过setuptools在Python 3.12+上使用distutils。
标签:cn,simple,pypi,环境,install,edu,pip,安装,Python3 From: https://www.cnblogs.com/terry-cc/p/17963675