在另一台PC上复制django项目(postgreSQL)

时间:2016-07-06 15:34:04

标签: python django postgresql

我的笔记本中有一个项目,我想在桌面上复制它。我在两个中都使用了Windows 7

我安装了python 3.5(不同版本,老实说,我的笔记本是3.4)和postgreSQL。 当然目录结构不同。我的笔记本是:

C:/ Python34 / scripts / myproject1

C:/ Python34 /脚本/ myproject1 / myvenv

在我的桌面上:

d:/ Python的/ PROGETTI / myproject1

d:/ Python的/ PROGETTI / myproject1 / myvenv

所以我在C:/.../myproject1中复制了D:/Python/progetti/,删除了myvenv目录,创建了一个新的virtualenv(同名)并试图安装requirements.txt中的要求,但是它给出了一个错误:

Installing collected packages: Django, django-crispy-forms,
django-registration-redux, docutils, Pillow, psycopg2, virtualenv, virtualenv
wrapper-win
  Running setup.py install for django-crispy-forms ... done
  Running setup.py install for django-registration-redux ... done
  Running setup.py install for psycopg2 ... error
    Complete output from command d:\python\progetti\possedimenti\myvenv\scripts\
python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\fabio\\AppDat
a\\Local\\Temp\\pip-build-xdv57y50\\psycopg2\\setup.py';exec(compile(getattr(tok
enize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
 install --record C:\Users\fabio\AppData\Local\Temp\pip-x4__ikww-record\install-
record.txt --single-version-externally-managed --compile --install-headers d:\py
thon\progetti\possedimenti\myvenv\include\site\python3.5\psycopg2:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.5
    creating build\lib.win32-3.5\psycopg2
    copying lib\errorcodes.py -> build\lib.win32-3.5\psycopg2
    copying lib\extensions.py -> build\lib.win32-3.5\psycopg2
    copying lib\extras.py -> build\lib.win32-3.5\psycopg2
    copying lib\pool.py -> build\lib.win32-3.5\psycopg2
    copying lib\psycopg1.py -> build\lib.win32-3.5\psycopg2
    copying lib\tz.py -> build\lib.win32-3.5\psycopg2
    copying lib\_json.py -> build\lib.win32-3.5\psycopg2
    copying lib\_range.py -> build\lib.win32-3.5\psycopg2
    copying lib\__init__.py -> build\lib.win32-3.5\psycopg2
    creating build\lib.win32-3.5\psycopg2\tests
    copying tests\dbapi20.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\dbapi20_tpc.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\testconfig.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\testutils.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_async.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_bugX000.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_bug_gc.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_cancel.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_connection.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_copy.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_cursor.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_dates.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_extras_dictcursor.py -> build\lib.win32-3.5\psycopg2\test
s
    copying tests\test_green.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_lobject.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_module.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_notify.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_psycopg2_dbapi20.py -> build\lib.win32-3.5\psycopg2\tests

    copying tests\test_quote.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_transaction.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_types_basic.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_types_extras.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_with.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\__init__.py -> build\lib.win32-3.5\psycopg2\tests
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    building 'psycopg2._psycopg' extension
    error: Unable to find vcvarsall.bat

    ----------------------------------------
Command "d:\python\progetti\possedimenti\myvenv\scripts\python.exe -u -c "import
 setuptools, tokenize;__file__='C:\\Users\\fabio\\AppData\\Local\\Temp\\pip-buil
d-xdv57y50\\psycopg2\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__f
ile__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Use
rs\fabio\AppData\Local\Temp\pip-x4__ikww-record\install-record.txt --single-vers
ion-externally-managed --compile --install-headers d:\python\progetti\possedimen
ti\myvenv\include\site\python3.5\psycopg2" failed with error code 1 in C:\Users\
fabio\AppData\Local\Temp\pip-build-xdv57y50\psycopg2\

我认为看起来有一些postgreSQL的问题。请注意,数据库尚不存在。

感谢您的帮助

2 个答案:

答案 0 :(得分:1)

python Postgres驱动程序psycopg2目前不支持Python 3.5:

  

当前的psycopg2实现支持:

     
      
  • Python 2版本从2.5到2.7
  •   
  • 3.1到3.4的Python 3版本
  •   
  • PostgreSQL版本从7.4到9.4
  •   

一个简单的解决方法是创建一个Python 3.4 virtual environment并在那里运行你的项目。

答案 1 :(得分:0)

我认为Python 3.5需要MS Visual C++ 2015(看here)所以我安装了它。我不确定这是件好事,因为它安装了17(!)更多MS .NET Framework 16(!)MS SQL Server,4或5更多MS Visual C++,{{1我的控制面板中有2-3个其他内容=>程序和功能。它的内容大约为2GB,安装/下载所需的时间超过2小时......这是正常的吗?

然后我注意到在我的requirements.txt中有Ms web deploypsycopg2==2.6.1(实际版本)支持python 3.5和postgreSQL 9.5所以我升级它而不是降级其他...

它有效,但我可以卸载MS visual 2015吗?