我是Python,Django和Heroku的新手。我试图按照设置here设置Django Heroku项目的说明进行操作。我陷入了以下命令:
$ pip install django-toolbelt
我收到以下错误
Requirement already satisfied (use --upgrade to upgrade): django-toolbelt in c:\
django\contactmanager\venv\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): django in c:\django\co
ntactmanager\venv\lib\site-packages (from django-toolbelt)
Downloading/unpacking psycopg2 (from django-toolbelt)
Running setup.py egg_info for package psycopg2
Downloading/unpacking gunicorn (from django-toolbelt)
Running setup.py egg_info for package gunicorn
warning: no previously-included files matching '*.pyc' found under directory
'docs'
warning: no previously-included files matching '*.pyo' found under directory
'docs'
warning: no previously-included files matching '*.pyc' found under directory
'tests'
warning: no previously-included files matching '*.pyo' found under directory
'tests'
warning: no previously-included files matching '*.pyc' found under directory
'examples'
warning: no previously-included files matching '*.pyo' found under directory
'examples'
Downloading/unpacking dj-database-url (from django-toolbelt)
Running setup.py egg_info for package dj-database-url
Downloading/unpacking dj-static (from django-toolbelt)
Running setup.py egg_info for package dj-static
Downloading/unpacking static (from dj-static->django-toolbelt)
Running setup.py egg_info for package static
Downloading/unpacking pystache (from static->dj-static->django-toolbelt)
Running setup.py egg_info for package pystache
pystache: using: version '0.6' of <module 'setuptools' from 'C:\Django\conta
ctmanager\venv\lib\site-packages\distribute-0.6.34-py2.7.egg\setuptools\__init__
.pyc'>
Installing collected packages: psycopg2, gunicorn, dj-database-url, dj-static, s
tatic, pystache
Running setup.py install for psycopg2
building 'psycopg2._psycopg' extension
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Django\contactmanager\venv\build\psycopg2\setup.py", line 568, in
<module>
ext_modules=ext)
File "C:\Python27\Lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Django\contactmanager\venv\lib\site-packages\distribute-0.6.34-py
2.7.egg\setuptools\command\install.py", line 53, in run
return _install.run(self)
File "C:\Python27\Lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\Lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\Lib\distutils\command\build_ext.py", line 337, in run
self.build_extensions()
File "C:\Python27\Lib\distutils\command\build_ext.py", line 446, in build_
extensions
self.build_extension(ext)
File "C:\Django\contactmanager\venv\build\psycopg2\setup.py", line 284, in
build_extension
build_ext.build_extension(self, extension)
File "C:\Python27\Lib\distutils\command\build_ext.py", line 496, in build_
extension
depends=ext.depends)
File "C:\Python27\Lib\distutils\msvc9compiler.py", line 473, in compile
self.initialize()
File "C:\Python27\Lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\Lib\distutils\msvc9compiler.py", line 299, in query_vcva
rsall
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
Complete output from command C:\Django\contactmanager\venv\Scripts\python.ex
e -c "import setuptools;__file__='C:\\Django\\contactmanager\\venv\\build\\psyco
pg2\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file_
_, 'exec'))" install --record c:\users\hp\appdata\local\temp\pip-ka3mfj-record\i
nstall-record.txt --single-version-externally-managed --install-headers C:\Djang
o\contactmanager\venv\include\site\python2.7:
running install
running build
running build_py
running build_ext
building 'psycopg2._psycopg' extension
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Django\contactmanager\venv\build\psycopg2\setup.py", line 568, in <mo
dule>
ext_modules=ext)
File "C:\Python27\Lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Django\contactmanager\venv\lib\site-packages\distribute-0.6.34-py2.7.
egg\setuptools\command\install.py", line 53, in run
return _install.run(self)
File "C:\Python27\Lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\Lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\Lib\distutils\command\build_ext.py", line 337, in run
self.build_extensions()
File "C:\Python27\Lib\distutils\command\build_ext.py", line 446, in build_exte
nsions
self.build_extension(ext)
File "C:\Django\contactmanager\venv\build\psycopg2\setup.py", line 284, in bui
ld_extension
build_ext.build_extension(self, extension)
File "C:\Python27\Lib\distutils\command\build_ext.py", line 496, in build_exte
nsion
depends=ext.depends)
File "C:\Python27\Lib\distutils\msvc9compiler.py", line 473, in compile
self.initialize()
File "C:\Python27\Lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\Lib\distutils\msvc9compiler.py", line 299, in query_vcvarsal
l
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
----------------------------------------
Command C:\Django\contactmanager\venv\Scripts\python.exe -c "import setuptools;_
_file__='C:\\Django\\contactmanager\\venv\\build\\psycopg2\\setup.py';exec(compi
le(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --re
cord c:\users\hp\appdata\local\temp\pip-ka3mfj-record\install-record.txt --singl
e-version-externally-managed --install-headers C:\Django\contactmanager\venv\inc
lude\site\python2.7 failed with error code 1 in C:\Django\contactmanager\venv\bu
ild\psycopg2
Storing complete log in C:\Users\hp\pip\pip.log
根据此link我应该在安装python-dev
之前安装python-psycopg2
,libpq-dev
,django-toolbelt
。
我在Windows机器上。我该如何安装这些依赖项?我尝试用pip安装它们,但这不起作用。
答案 0 :(得分:4)
显然psycopg2
安装程序无法在virtualenv环境下工作。我从http://stickpeople.com/projects/python/win-psycopg/
要在虚拟环境中安装本机二进制文件,请使用easy_install:
C:\virtualenv\Scripts\> activate.bat
(virtualenv) C:\virtualenv\Scripts\> easy_install psycopg2-2.5.win32-py2.7-pg9.2.4-release.exe
答案 1 :(得分:0)
此博文似乎对您的案例很有用:
或者您可以找到这些依赖包的Windows端口。