pip
Ubuntu安装
sudo apt install python3-pip
查看库版本:
pip list
pip list --outdated
pip show requests
升级库:
pip install --upgrade requests
国内镜像安装
pip install -i https://mirrors.aliyun.com/pypi/simple tensorflow
pip install -i https://mirrors.aliyun.com/pypi/simple -r requirement.txt
批量安装库
使用管理员权限运行指令时,安装位置为C:\Program Files\Python312\Lib\site-packages,没有管理员权限安装时,安装位置为:c:\users\cnmizhu7\appdata\roaming\python\python312\site-packages
pip install -r requirement.txt
//requirement.txt
wheel
requests
bs4
lxml
wfastcgi
Django
djangorestframework
django-filter
ws4py
pylint
proxy.py
sip
zeroconf
markdown
opcua
opcua-client
numpy
scipy
matplotlib
keras
tensorflow
cryptography
pyqt5
pyqt5-tools
pyqtgraph
PySide2
paho-mqtt
opencv-python
psycopg2-binary
打包工具 setuptools
pip install --upgrade setuptools
pybind11
pip install pybind11
–no-binary=:all:
用于指示 pip 在安装包时不使用预编译的二进制文件,而是从源代码进行安装。通过使用 --no-binary :all:
选项,pip 将会尝试从源代码进行安装,而不是使用预编译的二进制文件。这样可以确保安装的包与当前系统的配置和环境完全兼容。这在某些情况下可能很有用,例如当预编译的二进制文件不可用或与系统不兼容时。但是需要注意的是,从源代码进行安装可能会需要更长的时间,并且可能需要安装一些构建依赖项。
--no-binary
: 这是install
子命令的选项之一,用于指示 pip 在安装包时禁用预编译的二进制文件。-
:all:
: 这是--no-binary
选项的参数,指示禁用所有预编译的二进制文件。pip install numpy --no-binary :all: pip install numpy --no-binary numpy