0.本身已经安装python3.6
1.从外网下载解压pypiserver-master.zip
进入文件夹pypiserver-master
执行python setup.py install
提示缺少wheel
从外网下载解压缩wheel-0.33.6.tar.gz
进入文件夹:wheel-0.33.6
执行
python setup.py install
2.再次进入文件夹pypiserver-master
执行python setup.py install
提示缺少
从外网下载解压缩setuptools-git-1.2.tar.gz
进入文件夹:setuptools-git-1.2
执行python setup.py install
3.再次进入文件夹pypiserver-master
执行python setup.py install 报错,提示需要目录
创建文件夹G:\pypiserver
执行pip install -d G:\pypiserver pypiserver
成功
4.创建文件夹G:\pypiserver
启动pypiserver
pypi-server G:\pypiserver #默认8080
可以主动指定端口
pypi-server -p9090 G:\pypiserver
访问 http://localhost:8080/ 如果显示
"
Welcome to pypiserver!
This is a PyPI compatible package index serving 0 packages.
To use this server with pip, run the the following command:
pip install --extra-index-url http://localhost:8080/ PACKAGE [PACKAGE2...]
To use this server with easy_install, run the the following command:
easy_install -i http://localhost:8080/simple/ PACKAGE
The complete list of all packages can be found here or via the simple index.
This instance is running version 1.3.0 of the pypiserver software.
"
就是正常的
将自己编译好(python setup.py sdist)的包ccy-1.0.tar.gz放入目录 G:\pypiserver
卷 G 的文件夹 PATH 列表
卷序列号为 9C1E-658D
G:.
├─c11
│ ├─c111
│ │ └─__pycache__
│ └─__pycache__
├─c12
└─__pycache__
开始安装
pip install --extra-index-url http://localhost:8080/ ccy
pip install --extra-index-url http://localhost:8080/ ccy==1.0 #最好制定版本
卸载安装的包
pip uninstall ccy
--- 为了方便卸载,安装的时候需要写入日志
python setup.py install --record log
cat log|xagrs rm -rf
也可以用easy_install安装
easy_install -i http://localhost:8080/simple/ ccy
在我的环境中用这种不带版本的安装方式,python需要在引用包的时候添加如下语句
import pkg_resources
pkg_resources.require("ccy==1.0")
easy_install -i http://localhost:8080/simple/ ccy==1.0
卸载安装的包
easy_install -m ccy
测试脚本:
#TestMyPkg.py
#import pkg_resources
#pkg_resources.require("ccy==1.0")
import c11.f11
c11.f11.my11.showmyself()
转载于:https://www.cnblogs.com/cquccy/p/11395123.html