配置pip镜像源
pip.ini文件内容
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
pip.ini文件位置
# 86175 为我电脑的用户名
C:\Users\86175\pip
需要下载的包
请根据自己的需求下载依赖包
,以下为我需要下载的依赖包
Django==3.1.7
mysql-connector-python==8.0.23
selenium==3.141.0
celery==5.0.5
redis==3.5.3
APScheduler==3.7.0
django-redis-cache==3.0.0
requests==2.25.1
下载 selenium==3.141.0
pip install selenium==3.141.0
C:\Users\86175>pip install selenium==3.141.0
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting selenium==3.141.0
Downloading http://mirrors.aliyun.com/pypi/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl (904 kB)
|████████████████████████████████| 904 kB 2.2 MB/s
Requirement already satisfied: urllib3 in d:\environment\python\python39\lib\site-packages (from selenium==3.141.0) (1.26.7)
Installing collected packages: selenium
Successfully installed selenium-3.141.0
下载mysql-connector-python==8.0.23
pip install mysql-connector-python==8.0.23
C:\Users\86175>pip install mysql-connector-python==8.0.23
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting mysql-connector-python==8.0.23
Downloading http://mirrors.aliyun.com/pypi/packages/13/62/5234fb85bf30c28c70c6c7664926bd4b40e3c1d914f6e275174801cf8b8a/mysql_connector_python-8.0.23-py2.py3-none-any.whl (379 kB)
|████████████████████████████████| 379 kB 6.8 MB/s
Collecting protobuf>=3.0.0
Downloading http://mirrors.aliyun.com/pypi/packages/3b/97/033567f8a618e6219123a7a8675ac259fd7eec2dcece17297a6967bbde70/protobuf-3.18.0-cp39-cp39-win_amd64.whl (912 kB)
|████████████████████████████████| 912 kB 3.3 MB/s
Installing collected packages: protobuf, mysql-connector-python
Successfully installed mysql-connector-python-8.0.23 protobuf-3.18.0
下载APScheduler==3.7.0
pip install APScheduler==3.7.0
C:\Users\86175>pip install APScheduler==3.7.0
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting APScheduler==3.7.0
Downloading http://mirrors.aliyun.com/pypi/packages/5d/e9/b5e4f7aaea076bbfb241b04824c63cd42fe8029358103c27375e690bddc0/APScheduler-3.7.0-py2.py3-none-any.whl (59 kB)
|████████████████████████████████| 59 kB 1.8 MB/s
Collecting six>=1.4.0
Downloading http://mirrors.aliyun.com/pypi/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: pytz in d:\environment\python\python39\lib\site-packages (from APScheduler==3.7.0) (2021.1)
Collecting tzlocal~=2.0
Downloading http://mirrors.aliyun.com/pypi/packages/5d/94/d47b0fd5988e6b7059de05720a646a2930920fff247a826f61674d436ba4/tzlocal-2.1-py2.py3-none-any.whl (16 kB)
Requirement already satisfied: setuptools>=0.7 in d:\environment\python\python39\lib\site-packages (from APScheduler==3.7.0) (57.4.0)
Installing collected packages: tzlocal, six, APScheduler
Successfully installed APScheduler-3.7.0 six-1.16.0 tzlocal-2.1
其他依赖包下载方式相同,重点是配置好pip的镜像源
,采用国内的镜像源。
查看pip 列表
pip list
C:\Users\86175>pip list
Package Version
---------------------- ---------
amqp 5.0.6
APScheduler 3.7.0
asgiref 3.4.1
billiard 3.6.4.0
celery 5.0.5
certifi 2021.5.30
chardet 4.0.0
click 7.1.2
click-didyoumean 0.3.0
click-plugins 1.1.1
click-repl 0.2.0
Django 3.2.7
django-redis-cache 3.0.0
idna 2.10
kombu 5.1.0
mysql-connector-python 8.0.23
pip 21.2.4
prompt-toolkit 3.0.20
protobuf 3.18.0
pytz 2021.1
redis 3.5.3
requests 2.25.1
selenium 3.141.0
setuptools 57.4.0
six 1.16.0
sqlparse 0.4.2
tzlocal 2.1
urllib3 1.26.7
vine 5.0.0
wcwidth 0.2.5
C:\Users\86175>
生成requirments文件
生成requirments文件的的方法:
pip freeze > requirements
下载chromedriver.exe
浏览器使用的是谷歌浏览器:Google Chrome
chromedriver下载链接:
https://chromedriver.storage.googleapis.com/index.html
chromedriver版本需要和Google Chrome保持一致。
chromedriver.exe存放位置
如果chromedriver.exe存放位置不对的话,driver=webdriver.Chrome() 会报错! 一般需要存放在python下面的Scripts文件夹里面
,否则会报错
D:\Environment\Python\Python39\Scripts
写在最后
好啦,这就是本篇文章的全部内容啦!祝大家国庆假期愉快,要抓住假期的小尾巴哦!欢迎大家点赞,投币,转发。