python2.6 使用pip安装django报错

之前处理过这个问题,因为没有记录,所以第二次踩坑了,所以此次留存处理记录

centos6.5、默认的python2.6、pip1.5.4

安装django

pip install django

执行结果:

Downloading/unpacking django
  Downloading Django-2.1.1.tar.gz (8.6MB): 8.6MB downloaded
  Running setup.py (path:/tmp/pip_build_root/django/setup.py) egg_info for package django
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/django/setup.py", line 32, in <module>
        """.format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))
    ValueError: zero length field name in format
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/django/setup.py", line 32, in <module>

    """.format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))

ValueError: zero length field name in format

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/django
Storing debug log for failure in /root/.pip/pip.log

日志内容:

ValueError: zero length field name in format

----------------------------------------
Cleaning up...
  Removing temporary dir /tmp/pip_build_root...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/django
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 325, in run_egg_info
    command_desc=‘python setup.py egg_info‘)
  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/django

怀疑是没装setuptools

install --upgrade pip setuptools

Successfully installed pip setuptools
Cleaning up...

继续安装django尝试....报错

Traceback (most recent call last):
  File "/usr/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/usr/lib/python2.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/lib/python2.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/usr/lib/python2.6/site-packages/pip/_internal/index.py", line 536
    {str(c.version) for c in all_candidates},

这个报错就比较明显了

是python版本问题,因为默认的2.6不支持,最低要求2.7,所以升级2.7之后解决。

原文地址:https://www.cnblogs.com/garyzhuang/p/9607730.html

时间: 2024-08-15 09:11:26

python2.6 使用pip安装django报错的相关文章

ubuntu pip 安装django报错解决

系统版本 ubuntu  Kylin 16.04 LTS       安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pip3 install -i https://pypi.doubanio.com/simple/ 包名(django) 还有其他的解决方案,如修改配置文件 [global]块,的超时时间等

pip安装ujson报错: error:Microsoft Visual C++ 14.0 is required

在win10上pip安装ujson报错 之前一直用的是mac本,但由于疫情问题,最近不得不用win10系统来进行python开发,在使用pip安装依赖包ujson时,遇到了问题,如下: (custom_itsm) D:\DEVELOP\items\hn_test>pip install ujson DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python

pip安装requests报错unicodeEncodeError:&#39;ascii&#39; codec can\t encode charactesers in position 9-12:ordinal not in range(128)

前提 : 已经安装pip(pip的安装我参考的是本博客转载脚本之家的步骤,实验可以成功) 1. 在cmd输入命令转到pip安装目录: 2. 运行后出现错误 3. 步骤2中的错误应该和编码有关.搜索百度后,解决方法: 转自:joy32812 在你python的安装目录下的Lib目录,找到site.py,修改def setencoding()方法def setencoding(): ..... .... if 0: # Enable to support locale aware default s

python pip安装 mysqlclient 报错 raise EnvironmentError(&quot;%s not found&quot; % (_mysql_config_path,)) OSError: mysql_config not found

raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_config not found 解决办法 yum install mysql-devel python pip安装 mysqlclient 报错 raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_confi

pip安装mysql_python报错

_mysql.c:29:20: fatal error: Python.h: No such file or directory #include "Python.h" ^ compilation terminated. error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python2 -u -c "imp

pip 安装pycrypto 报错

pip 安装pycrypto 报src/MD2.c:31:20: error: Python.h: No such file or directory 错误解决 gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -f

pip 安装mysqlclient报错OSError: mysql_config not found

执行 pip install mysqlclient 报错信息如下: [[email protected] bin]# pip install mysqlclient Collecting mysqlclient Using cached mysqlclient-1.3.12.tar.gz Complete output from command python setup.py egg_info: /bin/sh: mysql_config: command not found Tracebac

windows使用pip安装selenium报错问题

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb9 in position 7: ordinal not in range(128) 这是编码问题,需要在你的python安装目录下 这是我的安装目录C:\Python27\Lib\site-packages 添加sitecustomize.py文件 文件内容添加 import sys sys.setdefaultencoding('gb2312') 之后在执行pip install -

安装Django报错的问题

cmd中在指定目录下进行 setup.py install 报错:from setuptools import setup, find_packages ImportError: No module named set 网上查解决方法写到: wget http://peak.telecommunity.com/dist/ez_setup.pypython ez_setup.py 不理解什么意思 输入wget http://peak.telecommunity.com/dist/ez_setup.