在过去的几个月里,我一直在使用SQLite作为我的数据库,同时学习django并建立一个网站。我终于决定是时候切换到PostgreSQL,因为我正在接近生产。我已经被困了几天,在错误之后追逐错误,基本上查看所有其他帖子并试图让它工作,但我仍然没有运气。最近,我尝试了http://web.archive.org/web/20101221084639/http://nukeit.org/compile-python-2-7-packages-with-visual-studio-2010-express/,但我仍然遇到错误。运行pip install psycopg2时最新的回溯如下:
Downloading/unpacking psycopg2
Running setup.py egg_info for package psycopg2
no previously-included directories found matching 'doc\src\_build'
Installing collected packages: psycopg2
Running setup.py install for psycopg2
building 'psycopg2._psycopg' extension
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Documents and Settings\user\projects\xLFTV\lftv\build\psycopg2\setup.py", line 557, 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:\Python27\lib\site-packages\distribute-0.6.27-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 339, in run
self.build_extensions()
File "C:\Python27\lib\distutils\command\build_ext.py", line 448, in build_extensions
self.build_extension(ext)
File "C:\Documents and Settings\user\projects\xLFTV\lftv\build\psycopg2\setup.py", line 275, in build_extension
build_ext.build_extension(self, extension)
File "C:\Python27\lib\distutils\command\build_ext.py", line 498, in build_extension
depends=ext.depends)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 474, in compile
self.initialize()
File "C:\Python27\lib\distutils\msvc9compiler.py", line 384, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 300, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
Complete output from command C:\Python27\python.exe -c "import setuptools;__file__='C:\\Documents and Settings\\user
\\projects\\xLFTV\\lftv\\build\\psycopg2\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__,
'exec'))" install --single-version-externally-managed --record c:\docume~1\user\locals~1\temp\pip-v_thso-record\install-
record.txt:
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:\Documents and Settings\user\projects\xLFTV\lftv\build\psycopg2\setup.py", line 557, 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:\Python27\lib\site-packages\distribute-0.6.27-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 339, in run
self.build_extensions()
File "C:\Python27\lib\distutils\command\build_ext.py", line 448, in build_extensions
self.build_extension(ext)
File "C:\Documents and Settings\user\projects\xLFTV\lftv\build\psycopg2\setup.py", line 275, in build_extension
build_ext.build_extension(self, extension)
File "C:\Python27\lib\distutils\command\build_ext.py", line 498, in build_extension
depends=ext.depends)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 474, in compile
self.initialize()
File "C:\Python27\lib\distutils\msvc9compiler.py", line 384, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 300, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
抱歉,如果它有点乱。在发布之前我试着尽可能地清理它。我对编程很新,而且我完全不知道还应该尝试什么。任何建议将不胜感激。在我的进展中,我已经看到了其他3个错误消息,并且不得不做其他几个下载试图使其工作。我愿意接受任何解决方案。
提前致谢。
答案 0 :(得分:0)
我和你有类似的故事......几天来我试着把头撞到墙上。解决问题的最简单方法是查找/下载/安装预构建的软件包。您可以找到它们的列表(包括psycopg2)here。 - 感谢Christoph Gohlke保持这些。
作为参考,您可以在相关主题here上看到我的帖子。
最后,让我提供一条免费的建议。如果你真的想在Python / Django中工作,那么切换到Linux会更容易。可能有90%以上的博客文章或“如何做”假设您正在运行某些Linux版本。我首先从Oracle下载VirtualBox并在其中安装Ubuntu。很长一段时间这已经足够好了。但是,我最终切换到双启动设置,我不再进入Windows窗口了。希望这会有所帮助。