有勇气的牛排博客

python依赖包安装 pip换源

有勇气的牛排 432 Python 2023-05-18 20:22:50

1 常用源

# 腾讯 http://mirrors.tencentyun.com/pypi/simple # 阿里 https://mirrors.aliyun.com/pypi/simple # 豆瓣 https://pypi.douban.com/simple # 中科大 https://pypi.mirrors.ustc.edu.cn/simple/ # 清华 https://pypi.tuna.tsinghua.edu.cn/simple

2 单条命令换源安装

pip后面跟python版本号,如果只安装一个python解释器,就可以不用写版本号

pip3.7 install bottle -i https://pypi.douban.com/simple pip3.6 install requests -i https://pypi.douban.com/simple pip install lxml -i https://pypi.douban.com/simple pip install bs4 -i https://pypi.douban.com/simple pip install tornado -i https://pypi.douban.com/simple pip install twisted -i https://pypi.douban.com/simple

带版本号

pip install tensorflow==1.15.0 -i https://mirrors.aliyun.com/pypi/simple

3 写配置文件 永久修改

3.1 linux

vim ~/.pip/pip.conf (没有就创建一个)
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

3.2 windows

创建文件
C:\Users\Administrator\pip.ini

[global] timeout = 6000 index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.com

4 导出项目依赖

pip freeze >requirements.txt

5 包存储路径

linux: ./Python-3.8.5/lib/python3.8/site-packages
windows: C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Lib\site-packages

6 whl安装

下载
https://www.lfd.uci.edu/~gohlke/pythonlibs

7 常用依赖

通用

requests bs4 lxml furl selenium Flask Flask-Migrate Flask-Script Flask-SQLAlchemy Jinja2 PyJWT PyYAML PyMySQL mysql-connector SQLAlchemy redis hdfs PyHive spark pyspark thrift thrift-sasl elasticsearch paramiko numpy Pillow

异步

aiofiles==0.8.0 aiohttp==3.8.3 aiomysql==0.1.1 aiosignal==1.2.0 sanic Sanic-Cors sanic-ext sanic-jwt sanic-routing sanic-session

python3.7.1_64

PyMySQL==1.0.2 mysql-connector==2.2.9 hdfs==2.7.0 PyHive==0.6.5 thrift==0.16.0 thrift-sasl==0.4.3 sasl paramiko==3.0.0 redis==4.5.1 requests==2.28.2 bs4==0.0.1 lxml==4.9.2 Jinja2==3.1.2 furl==2.1.3 Flask==2.2.3 flask-cors==3.0.10 Flask-Migrate Flask-Script Flask-SQLAlchemy Jinja2 PyJWT PyYAML SQLAlchemy

作者地址:
https://www.couragesteak.com/article/67


留言

专栏
文章
加入群聊