虚拟环境安装django出的问题

在win7 64位系统及PyCharm 2017企业版中,使用pip安装Django 1.11时遇到AttributeError。错误源于pip安装过程。参考GitHub上的解决方案(https://github.com/pypa/pip/issues/2669#issuecomment-136405390),通过执行`easy_install -U pip`更新pip,尽管出现部分找不到文件的警告,但最终成功将pip升级到最新版,解决了安装问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

虚拟环境安装django出的问题

一、环境:win7 64位,pycharm2017企业版本,安装版本django 1.11。

二、问题:在虚拟项目目录下终端(terminal)下安装:pip install django==1.11

三、在安装完的时候提示如下:

Installing collected packages: pytz, django
Successfully installed django-1.11 pytz-2018.5
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(venv) E:\pythonproject>python -m pip install --upgrade pip
四、执行:
python -m pip install --upgrade pip

报错提示:

Exception:
Traceback (most recent call last):
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\basecommand.py", line 215, i
n main
    status = self.run(options, args)
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\commands\install.py", line 3
42, in run
    prefix=options.prefix_path,
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\req\req_set.py", line 784, i
n install
    **kwargs
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\req\req_install.py", line 85
1, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\req\req_install.py", line 10
64, in move_wheel_files
    isolated=self.isolated,
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\wheel.py", line 462, in move
_wheel_files
    generated.extend(maker.make(spec))
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py",
 line 372, in make
    self._make_script(entry, filenames, options=options)
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py",
 line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py",
 line 212, in _write_script
    launcher = self._get_launcher('t')
  File "E:\pythonproject\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py",
 line 351, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

这是报错提示:

AttributeError: 'NoneType' object has no attribute 'bytes'

直接Bing搜索,搜索出解决问题地址:https://github.com/pypa/pip/issues/2669#issuecomment-136405390 

再次整理下。

五、在终端执行:

easy_install -U pip #执行简易安装。

下面安装过程中有部分文件未找到,可忽略。

(venv) E:\pythonproject>easy_install -U pip  #执行简易安装。
Searching for pip
Reading https://pypi.python.org/simple/pip/
Downloading https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a
57446f08259dee8f02/pip-10.0.1.tar.gz#sha256=f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203f
dbd7ee68
Best match: pip 10.0.1
Processing pip-10.0.1.tar.gz
Writing C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-e28l98hi\pip-10.0.1\setup.cfg
Running pip-10.0.1\setup.py -q bdist_egg --dist-dir C:\Users\ADMINI~1\AppData\Local\Temp\easy_instal
l-e28l98hi\pip-10.0.1\egg-dist-tmp-6ldyf5xx
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching '.landscape.yml'
warning: no previously-included files found matching 'src\pip\_vendor\Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching '*-requirements.txt'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'src\pip\_vendor\six'
warning: no previously-included files matching '*.pyi' found under directory 'src\pip\_vendor'
no previously-included directories found matching '.github'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs\build'
no previously-included directories found matching 'news'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'  #这里黄色显示有部分未找到的信息,请安装的时候注意查看。
creating e:\pythonproject\venv\lib\site-packages\pip-10.0.1-py3.6.egg
Extracting pip-10.0.1-py3.6.egg to e:\pythonproject\venv\lib\site-packages
Adding pip 10.0.1 to easy-install.pth file
Installing pip-script.py script to E:\pythonproject\venv\Scripts
Installing pip.exe script to E:\pythonproject\venv\Scripts
Installing pip3-script.py script to E:\pythonproject\venv\Scripts
Installing pip3.exe script to E:\pythonproject\venv\Scripts
Installing pip3.6-script.py script to E:\pythonproject\venv\Scripts
Installing pip3.6.exe script to E:\pythonproject\venv\Scripts


Installed e:\pythonproject\venv\lib\site-packages\pip-10.0.1-py3.6.egg
Processing dependencies for pip
Finished processing dependencies for pip

六、再次终端执行,已经更新到最新版本:

python -m pip install --upgrade pip  #进行检查
 

提示是最新版本:

(venv) E:\pythonproject>python -m pip install --upgrade pip
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Requirement already up-to-date: pip in e:\pythonproject\venv\lib\site-packages (10.0.1)

                                                                                                                                              by  phantom






评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值