2016-07-06 269 views
0

我在筆記本中有一個項目,我想將它複製到我的桌面。我使用Windows 7中的將django項目複製到另一臺PC(postgreSQL)

我安裝了python 3.5(不同版本,說實話,在我的筆記本上是3.4)和postgreSQL。 當然的目錄結構是不同的。在我的筆記本是:

C:/ Python34 /腳本/ myproject1

C:/ Python34 /腳本/ myproject1/myvenv

雖然在我的桌面:

d:/ Python的/ PROGETTI/myproject1

d:/ Python的/ PROGETTI/myproject1/myvenv

所以我在D:/Python/progetti/複製C:/.../myproject1,刪除myvenv主任Y,創造了一個新的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的,我想。請注意,數據庫尚不存在。

謝謝您的幫助

+0

pyscopg2的安裝過程涉及編譯C擴展。你有那個需要的工具嗎? – spectras

+0

我不知道...我需要什麼工具?也許我可以在我的筆記本上進行控制? – fabio

+1

從名稱'vcvarsall.bat'我猜這是尋找MS Visual C++ – spectras

回答

1

的Python 3.5目前不蟒蛇的Postgres驅動psycopg2支持:

The current psycopg2 implementation supports:

  • Python 2 versions from 2.5 to 2.7
  • Python 3 versions from 3.1 to 3.4
  • PostgreSQL versions from 7.4 to 9.4

一個簡單的解決辦法是建立一個Python 3.4 virtual environment並運行項目那裏。

0

我認爲Python 3.5需要MS Visual C++ 2015(看起來here),所以我安裝了它。我不確定這是不是一件好事,因爲它安裝了類似於17(!)的更多MS .NET Framework 16(!)MS SQL Server,4或5個以上MS Visual C++,Ms web deploy和其他2-3個事項在我的控制面板中=>程序和功能。這大概是2GB的東西,安裝/下載需要花費2個多小時......這是正常的嗎?

然後我注意到,在我的requirements.txt有psycopg2==2.6.1psycopg2 2.6.2(實際版本)支持Python 3.5和PostgreSQL 9.5,所以我升級而不是降級其他...

它的工作原理,但也許我可以卸載MS visual 2015嗎?

相關問題