table of Contents
- Download Source Package python using douban
- Watercress source as the download source
- python pip install, update, uninstall, demotion, and use pip Management Pack
- View all methods in python modules
- Pyodbc installation package
- Resolve Command "python setup.py egg_info" failed with error code 1 issue
- Pip command input error: from pip import main ImportError: can not import name 'main'
- Solution _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} pip problem
- Pip install the specified version, python2.6.6 not supported after pip10.
- pip installation fails (always Retry)
- use pip install python package Notes
- Solve 'python -m pip install --upgrade pip' error problem
- window configuration pip domestic source
- Lack zlib module
- Module missing mysql-devel
- 报错error: command 'gcc' failed with exit status 1
Download Source Package python using douban
Tags (separated by spaces): Unclassified
Watercress source as the download source
Watercress Download: HTTP: //pypi.douban.com/simple
1, specify the use of watercress source as the download source when using pip download (here we download tornado)
pip install tornado -i http://pypi.douban.com/simple
Solution:
Clearly see the message there is no confidence in this douban download the source, then we give him a confidence motion
pip install tornado -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
We encountered when using the tool to download tornado pip a problem, pip is not installed - - now installed at pip
Prepared in advance a get-pip.py installation package (from the Internet to find myself go)
Also use our douban source to install it (have dependencies), a command to get
python get-pip.py -i http://pypi.douban.com --trusted-host pypi.douban.com
3, now have learned to use domestic sources douban download python bag, but encountered a problem, would have to perform each time you download a big long string of commands so what - -
Of course, we have a solution, see below
first step:
Create a profile
/root/.pip/pip.conf
This configuration file directory does not even exist, you need to manually create, not to accidentally
Step two:
In the configuration file to write something, what it means to look up specific
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host = pypi.douban.com
third step
You can normally use, for example,
python pip install, update, uninstall, demotion, and use pip Management Pack
Installation pip
Mounting official website (recommended)
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
Linux apt installation
sudo apt-get install python-pip
Update pip
pip install --upgrade pip
#
pip install -U pip
Uninstall pip
sudo apt-get remove python-pip
pip version downgrade
python -m pip install pip==版本(如:9.0.3)
Use pip Management Pack
List installed packages
pip freeze 或 pip list
Freeze PIP
PIP Freeze can be used to derive its version of the package already installed and saved as a file, as follows:
PIP Freeze> filename (e.g. requirements.txt)
saved file (requirements.txt) may be directly used to install or uninstall, as follows:
install -r requirements.txt PIP
PIP Uninstall -r requirements.txt
Installation package
pip install 包名
To install a specific version of the package
pip install 包名==版本
Other editions range control symbols: ==,> =, <=,>, <
pip install the latest version of the package name #
pip install package name == # version specified version
pip install 'package name> version =' minimum version #
Upgrade package
pip install --upgrade 包名
#或
pip install -U 包名
Uninstall package
pip uninstall 包名
The use of domestic sources
sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 包名
View all methods in python modules
pydoc modules
>>> help("modules")
#python的sys模块也是可以用来查看模块信息的
import sys
sys.modules.keys()
Use the command line to view the pip
If you are using a pip as your python package manager, you can run the command line directly
pip freeze
or
pip list to view information about the installation package, of course, other package managers have similar functions, at the same time, you can also in introducing python interactive interpreter module to view the package information pip
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
Use yolk to view
yolk, then if you have installed can use the yolk command to view packet information, you can use the $ pip install yolk yolk to install it simple to use, just the command line can operate under
$ yolk -l #列出所有安装模块
$ yolk -a #列出激活的模块
$ yolk -n #列出非激活模块
$ yolk -U [packagename] # 通过查询pypi来查看(该)模块是否有新版本
Pyodbc installation package
sudo apt-get install unixodbc-dev
Resolve Command "python setup.py egg_info" failed with error code 1 issue
pip install --upgrade setuptools
python -m pip install --upgrade pip
Pip command input error: from pip import main ImportError: can not import name 'main'
Error connection
qly@qlyComputer:~$ pip
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name 'main'
Mainly due to the ubuntu version due to upgrade pipd
Note: Because if / usr / bin / pip3 is a read-only file, without sudo, you may be prompted to insufficient permissions, if forced stored in read-only permission can result in damaged files, it is recommended when modifying the configuration files to see if we have permission to
modify It reads as follows:
原文:from pip import main
修改后:from pip._internal import main
Then run pip still being given and continue to change the configuration file
Then pip change the configuration file with the same command
vi /usr/bin/pip
Modified as follows:
//修改前
from pip import main
if __name__ == '__main__':
sys.exit(main())
修改后
from pip import __main__ //这行也要修改
if __name__ == '__main__':
sys.exit(__main__._main())//增加__main__._
Solution _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} pip problem
python2.6 get-pip.py 报错下面的错误
_blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} pip
解决方案:
# 1, 从官方github获取具体版本的pip
wget https://raw.githubusercontent.com/pypa/get-pip/master/2.6/get-pip.py
# 2,运行刚才获取的pip文件
python2.6 get-pip.py
Pip install the specified version, python2.6.6 not supported after pip10.
https://pypi.org Go to the download site desired version of pip
View the version history
Pip install with apt-get
sudo apt-get remove python-pip
But sometimes via apt-get install pip version too old, it will be reported reminded to upgrade pip pip when using an older version to install some packages. If you want to upgrade the latest pip, need to uninstall pip, command
sudo apt-get remove python-pip
Then install the source with the pip by the following method.
Source installation pip
Https://pypi.python.org/pypi/pip this site to download the corresponding version of the source, recommended as this compression format: pip-9.0.1.tar.gz, and then to the download directory, unzip the file and enter :
tar -xzvf pip-9.0.1.tar.gz
cd pip-9.0.1
sudo python setup.py install
pip installation fails (always Retry)
Always use pip install the following errors:
Mirroring too slow
pip install -i https://pypi.douban.com/simple django
Unable to resolve domain name
vim /etc/resolv.conf
#添加如下几行,
nameserver 8.8.4.4
nameserver 8.8.8.8
use pip install python package Notes
The need to upgrade and then install pip
Related Commands
python -m pip install --upgrade pip
pip install --upgrade pip
pip install --upgrade wheel
pip3 install aiohttp
#例如安装图像包
pip install Pillow
#安装mysql
pip install mysql-connector-python-rf --allow-external mysql-connector-python
#安装sqlalchemy--ORM数据库
pip install sqlalchemy
Solve 'python -m pip install --upgrade pip' error problem
When prompted to install the package
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
And I follow the requirements to run python -m after pip install --upgrade pip still not succeed, tips are as follows:
(venv) D:\Fish>python -m pip install --upgrade pip
Requirement already up-to-date: pip in d:\fish\venv\lib\site-packages (10.0.1)
So accordance with the requirements will be d:\fish\venv\lib\site-packages (10.0.1) 中的pip-10.0.1.dist-info
deleted, run again python -m pip install --upgrade pip
after the upgrade, before installing the package can not be installed!
window configuration pip domestic source
Folder window, enter:% APPDATA%
New pip folder
created pip.ini file
enter the following:
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
Lack zlib module
Installation error
Compression requires the (missing) zlib module
Installation failed due to lack of zlib module
yum install zlib zlib-devel -y
#重新执行
make && make install
python ./setup.py install
Module missing mysql-devel
An error
EnvironmentError: mysql_config not found
Common solutions
yum install mysql-devel
Unresolved reference to the following description
rpm -qa | grep mysql
to find the corresponding package mysql version
download the corresponding version of mysql-devel, http: //rpm.pbone.net/
rpm -ivh ftp://mirror.switch.ch/pool/4/mirror/mysql/Downloads/MySQL-5.6/mysql-community-devel-5.xxxxx.x86_64.rpm
Installation again
pip install mysql-python
报错error: command 'gcc' failed with exit status 1
centos need to install python-devel, ubuntu need to install python-dev, but not solve the problem
currently using python2.7 version, yum install -y python2-devel
if using python3.6 version, yum install -y python3-devel
perhaps to use as a small version numberyum install -y python3.6-devel
Mirror domestic sources are:
V2EX: http: //pypi.v2ex.com/simple
watercress: http: //pypi.douban.com/simple
University of Science and Technology of China: http: //pypi.mirrors.ustc.edu.cn/simple/
Qinghua: https : //pypi.tuna.tsinghua.edu.cn/simple