PIP本地源搭建
Wheel包制作
# pip install wheel
# mkdir ~/wheels
# cd < Project >
# pip wheel --wheel-dir=~/wheels .
# cd ~/
# tar acf wheels.tar.gz wheels
### 使用本地包进行安装
# tar axf wheels.tar.gz wheels
# cd wheels
# pip install --use-wheel --no-index --find-links=./ < Package >
Ubuntu
- 下载pip2pi
# apt install python-pip
# pip install --upgrade pip
# pip install pip2pi
- 搭建apache2服务
# apt install apache2
# mkdir -p /var/www/packages
# sed -i -e "s/ServerAdmin.*/ServerAdmin pypi.com/g" /etc/apache2/sites-available/000-default.conf
# sed -i -e "s/DocumentRoot.*/DocumentRoot \/var\/www\/packages/g" /etc/apache2/sites-available/000-default.conf
# a2ensite 000-default
# systemctl restart apache2
- 批量下载软件包
### 生成tar.gz或whl包
# cd Downloads/
# wget http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton -O requirements.txt
### -r参数用来表示要安装的软件包,-c参数用来限制要安装的软件包的版本
# pip2tgz /var/www/packages -r requirements.txt
### 只生成whl包
# pip wheel --timeout 120 --wheel-dir /var/www/packages --find-links /var/www/packages --build /tmp/openstack-builder --log /var/log/repo/repo_builder.log --requirement requirements.txt
- 建立索引
# dir2pi /var/www/packages
- 单独下载软件包并更新索引
# pip2tgz /var/www/packages zake===0.2.2
# dir2pi /var/www/packages
- 测试pip源
### 访问http://192.168.30.142/simple/index.html
# curl -I http://192.168.30.142/simple/zake/zake-0.2.2-py2.py3-none-any.whl | head -n1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 19139 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
HTTP/1.1 200 OK
问题处理
- MySQL-python安装报错
Saved /var/www/pypi/MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-5pxlt9/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-5pxlt9/MySQL-python/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-5pxlt9/MySQL-python/setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
解决办法
# apt install libmysqld-dev
- Psycopg2安装报错
Saved /var/www/pypi/psycopg2-2.6.2.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
解决办法
# apt install libpq-dev
- Xattr安装报错
Collecting xattr===0.8.0 (from -r requirements.txt (line 397))
Downloading xattr-0.8.0.tar.gz
Saved /var/www/pypi/xattr-0.8.0.tar.gz
Complete output from command python setup.py egg_info:
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
解决办法
# apt install libffi-dev
CentOS
- 下载pip2pi
# yum install python-pip
# pip install --upgrade pip
# pip install pip2pi
- 搭建apache服务
# apt install httpd
# mkdir -p /var/www/packages
# vim /etc/httpd/conf.d/vhost.conf
Listen 81
<VirtualHost *:81>
DocumentRoot "/var/www/packages/simple"
ServerName pypi.com
Errorlog /var/log/httpd/pypi.error.log
CustomLog /var/log/httpd/pypi.access.log common
</VirtualHost>
# systemctl restart httpd
- 批量下载软件包
# wget http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton -O requirements.txt
# yum install mysql-devel libffi-devel libpqxx-devel
# pip wheel --timeout 120 --wheel-dir /var/www/packages --find-links /var/www/packages --build /tmp/openstack-builder --log /var/log/repo/repo_builder.log --requirement requirements.txt
- 建立索引
# dir2pi /var/www/packages
- 测试pip源
### 访问http://192.168.30.142:81
PIP本地源搭建的更多相关文章
- CentOS6.5 本地源搭建Ceph
拓扑图 OS: CentOS X86_64,desktop -免密码登录 -修改/etc/sysconfig/network --hostname -修改/etc/hosts/ -关闭iptabl ...
- centos本地源搭建——iso
说明:centos源搭建比另一篇ubuntu源搭建简单些,操作也简单.思路是用iso制作一个本地源,后期需要新软件可以自己添加. 1.进入iso挂载路径,这里是虚拟机,在vm上挂载,在linux下直接 ...
- ubuntu 本地源搭建
1.软件包放在 deps 目录下: dpkg-scanpackages deps /dev/null |gzip > deps/Packages.gz -r 2.更新 sources.list ...
- 基于VSFTP的本地YUM源及光盘YUM源搭建
基于VSFTP的本地YUM源及光盘YUM源搭建 一.yum环境的本地源搭建(基于VSFTP): 1)安装vsftp; *********************************** ...
- ubuntu下的apt-get内网本地源的搭建
APT本地源的搭建(可用于局域网apt-get源搭建或者本地源) 本文档介绍使用apt-mirror软件搭建apt本地源 需求:内网开发环境由于其特定原因不能上外网,所以需要本地环境下的内网源来方便开 ...
- Linux 本地yum源搭建和网络yum源搭建
一.本地yum源搭建 首先挂载上光盘 [root@www /]# mount /dev/cdrom /media/cdrom/ 系统默认已经安装了可使用yum的软件包,所以可以直接配置: [root@ ...
- 基于本地iso 搭建的本地yum源 安装部署openldap
1,yum openldap-servers,openldap-clients 基于iso-cd1搭建的本地yum源(具体搭建参看ruige的repo本地快速搭建,在右边 找找看中输入repo key ...
- 搭建yum本地源_阿里云CentOS服务器初始化设置
CentOS服务器初始化设置其实不分阿里云或其它服务器了,操作配置过程与步骤也差不多一.挂载硬盘 1.磁盘分区 fdisk -l #查看设备,一般可以看到设备名为/dev/xvdb fdisk /de ...
- CentOS7利用yum缓存搭建本地源
CentOS7利用yum缓存搭建本地源 环境说明 [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 ( ...
随机推荐
- Codeforces 900D Unusual Sequences:记忆化搜索
题目链接:http://codeforces.com/problemset/problem/900/D 题意: 给定x,y,问你有多少个数列a满足gcd(a[i]) = x 且 ∑(a[i]) = y ...
- jQuery绑定事件的四种方式区别
jQuery中提供了四种事件监听方式,分别是bind.live.delegate.on,对应的解除监听的函数分别是unbind.die.undelegate.off.在开始看他们之前 一:bind(t ...
- 内存表 ClientDataSet CreateDataSet
unit Form_Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, F ...
- MyEclipse消除frame引起的the file xxx cannot be found
因为该页面所指向的页面路径不对,便进行手动修改,修改时却出现了很烦的问题,输入一个字就弹出一个提示框“the file XXX can not be found.Please check the lo ...
- POJ-1741(树分治)
树的点分治 给出详细的讲解!!点这里打开论文-分治算法在树的路径问题中的应用 本题目是他讲的第一个例题: 我的理解:每次都找树的重心,计算以重心为根的子树之间所贡献的答案.不断这样下去:如果这棵树是一 ...
- QFileInfo与QFileIconProvider(分别用于获取文件信息和获取文件的图标)
判断文件是否存在,获取文件名称,绝对路径,修改时间等等信息 fileInfo = Qt.QFileInfo(filename) fileIcon = Qt.QFileIconProvider() ic ...
- 【leetcode刷题笔记】Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head. For example, Give ...
- JS数组的sort排序
数组sort方法排序var aa=[6,2,1,5]//默认是从小到大排序aa.sort()[1, 2, 5, 6] //下面也是从小到大排序aa.sort(function(a,b){return ...
- 人物-IT-马化腾:马化腾
ylbtech-人物-IT-马化腾:马化腾 马化腾,1971年10月29日生于原广东省海南岛东方市八所港(今海南省东方市),祖籍广东省汕头市.腾讯公司主要创办人之一.现任腾讯公司董事会主席兼首席执行官 ...
- 输出缓存与CachePanel
缓存的级别 缓存的作用自不必说,提高系统性能最重要的手段之一.上至应用框架,下至文件系统乃至CPU,计算机中各部分设计都能见到缓存的身影.许多朋友一直在追求如何提高Web应用程序的性能,其实最容易被理 ...