本文共 1860 字,大约阅读时间需要 6 分钟。
1.首先在官网下载python3.8安装(注意add环境变量)
2. windows cmd 运行
pip install requests
报错:一大串红 raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
3.在Windows下:
C:\Users\Administrator\下新建pip文件夹,在创建pip.ini文件,拷贝下面代码进去,保存。
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple
4.windows下在cmd中,linux在终端下输入如下命令:
pip --default-timeout=100 install -U pip
5.再次执行就行了
pip3 install lxml
报错:
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
6.运行
python -m pip install -U pip
7.再次执行命令
再次报错:
raise ReadTimeoutError(self._pool, None, "Read timed out.") pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
库网
8.pip install 保存路径/加上下载的文件名 进行安装
或者pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ lxml
ok了
pip install flask或者pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ flask
OK了
>python main.py * Serving Flask app "main" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
windows
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'c:\\program files\\python\\lib\\site-packages\\pip-10.0.1.dist-info\\entry_points.txt' Consider using the `--user` option or check the permissions.
pip install bs4 --userpip install requests --user
1. File– Setting
2. Project:Python – Project Interperter
3.+ =》搜索=》bs4
4.install package
5.install successfully
转载地址:http://kdtin.baihongyu.com/