installation
https://pip.pypa.io/en/stable/installation/
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.8 get-pip.py
If your pip version does not match the python version, you need to reinstall in this way
错误解决办法
-
UnicodeDecodeError
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd5 in position 24: invalid continuation byte
http://stackoverflow.com/questions/25036897/pip-install-unicodedecodeerror
解决办法:
$ export LC_ALL="en_US.UTF-8"
使用方法
# 生成需求文件
$ pip freeze >requirements.txt
# 从需求文件安装
$ pip install -r requirements.txt
problems
-
specify a version
$ pip install "your python packet"==1.0.0
-
PIL
$ pip install Pillow
-
TypeError: call() takes exactly 2 arguments (1 given)
$ pip install setuptools==33.1.1
-
command ‘gcc’ failed with exit status 1
参照:
http://stackoverflow.com/questions/19955775/error-command-gcc-failed-with-exit-status-1-on-centos
$ yum -y install gcc gcc-c++ kernel-devel $ yum -y install python-devel libxslt-devel libffi-devel openssl-devel $ pip install "your python packet"
-
MySQLdb
$ pip install Mysql-Python # 如果安装不上,则安装下面的软件 $ yum install -y mysql-devel python-devel python-setuptools
-
memcache
$ pip install python-memcached
-
yaml
$ yum install python-yaml
-
weixin.client
$ pip install python-weixin
-
pandas
http://youerning.blog.51cto.com/10513771/1711008
$ pip install pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
or
$ pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple
or you can add above args to the
requirements.txt
like this:-i http://pypi.douban.com/simple --trusted-host pypi.douban.com gunicorn==20.1.0 pandas==1.4.4 ...
aliyun mirror is more update than douban mirror, so you can use it:
-i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com ...
-
mysqlclient
error:
No matching distribution found for mysqlclient==2.1.1 OSError: mysql_config not found ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
need to install libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
-
Specify the installation path
pip install --target=/usr/local/lib/python2.7/dist-packages/ gevent