本文主要是介绍离线安装setuptools,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在python在安装软件时,有时会出现No module named setuptools的提示,解决方法如下:1. 下载ez_setup.py。Linux下可使用此命令: wget -q http://peak.telecommunity.com/dist/ez_setup.py。
2. 运行ez_setup.py:python ez_setup.py ;如果运行正常,那就安装成功了。
如果此时失败(如内网安装等问题),则根据链接地址手动下载该egg包。
203 def main(argv, version=DEFAULT_VERSION):
204 """Install or upgrade setuptools and EasyInstall"""
205 try:
206 import setuptools
207 except ImportError:
208 egg = None
209 try:
210 #egg = download_setuptools(version, delay=0)
211 egg="/usr/local/app/setuptools-0.6c11-py2.7.egg"
212 sys.path.insert(0,egg)
213 from setuptools.command.easy_install import main
214 return main(list(argv)+[egg]) # we're done here
215 finally:
216 if egg and os.path.exists(egg):
217 os.unlink(egg)
将egg赋值为egg存储的位置,重新运行脚本。
显示:
Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /usr/local/lib/python2.7/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin
Installed /usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
表示安装成功。
这篇关于离线安装setuptools的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!