安装项目依赖项时出错

时间:2020-06-25 01:51:05

标签: python pip

(env) C:\Users\CSUFTitan\Desktop\Final_Starter\backend>pip3 install -r requirements.txt
Requirement already satisfied: aniso8601==6.0.0 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 1)) (6.0.0)
Requirement already satisfied: Click==7.0 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 2)) (7.0)
Requirement already satisfied: Flask==1.0.3 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 3)) (1.0.3)
Requirement already satisfied: Flask-Cors==3.0.7 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 4)) (3.0.7)
Requirement already satisfied: Flask-RESTful==0.3.7 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 5)) (0.3.7)
Requirement already satisfied: Flask-SQLAlchemy==2.4.0 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 6)) (2.4.0)
Requirement already satisfied: itsdangerous==1.1.0 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 7)) (1.1.0)
Requirement already satisfied: Jinja2==2.10.1 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 8)) (2.10.1)
Requirement already satisfied: MarkupSafe==1.1.1 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 9)) (1.1.1)
Collecting psycopg2-binary==2.8.2
  Using cached psycopg2-binary-2.8.2.tar.gz (369 kB)
Requirement already satisfied: pytz==2019.1 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 11)) (2019.1)
Requirement already satisfied: six==1.12.0 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 12)) (1.12.0)
Requirement already satisfied: SQLAlchemy==1.3.4 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 13)) (1.3.4)
Requirement already satisfied: Werkzeug==0.15.4 in c:\users\csuftitan\desktop\final_starter\env\lib\site-packages (from -r requirements.txt (line 14)) (0.15.4)
Using legacy setup.py install for psycopg2-binary, since package 'wheel' is not installed.
Installing collected packages: psycopg2-binary
  Attempting uninstall: psycopg2-binary
    Found existing installation: psycopg2-binary 2.8.5
    Uninstalling psycopg2-binary-2.8.5:
      Successfully uninstalled psycopg2-binary-2.8.5
    Running setup.py install for psycopg2-binary ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\csuftitan\desktop\final_starter\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CSUFTitan\\AppData\\Local\\Temp\\pip-install-1nbc6jyl\\psycopg2-binary\\setup.py'"'"'; __file__='"'"'C:\\Users\\CSUFTitan\\AppData\\Local\\Temp\\pip-install-1nbc6jyl\\psycopg2-binary\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\CSUFTitan\AppData\Local\Temp\pip-record-k_sqf8bd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\csuftitan\desktop\final_starter\env\include\site\python3.8\psycopg2-binary'
         cwd: C:\Users\CSUFTitan\AppData\Local\Temp\pip-install-1nbc6jyl\psycopg2-binary\
    Complete output (22 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\psycopg2
    copying lib\compat.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\errorcodes.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\errors.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\extensions.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\extras.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\pool.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\sql.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\tz.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\_ipaddress.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\_json.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\_lru_cache.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\_range.py -> build\lib.win-amd64-3.8\psycopg2
    copying lib\__init__.py -> build\lib.win-amd64-3.8\psycopg2
    running build_ext
    building 'psycopg2._psycopg' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
  Rolling back uninstall of psycopg2-binary
  Moving to c:\users\csuftitan\desktop\final_starter\env\lib\site-packages\psycopg2\
   from C:\Users\CSUFTitan\Desktop\Final_Starter\env\Lib\site-packages\~sycopg2
  Moving to c:\users\csuftitan\desktop\final_starter\env\lib\site-packages\psycopg2_binary-2.8.5.dist-info\
   from C:\Users\CSUFTitan\Desktop\Final_Starter\env\Lib\site-packages\~sycopg2_binary-2.8.5.dist-info
ERROR: Command errored out with exit status 1: 'c:\users\csuftitan\desktop\final_starter\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CSUFTitan\\AppData\\Local\\Temp\\pip-install-1nbc6jyl\\psycopg2-binary\\setup.py'"'"'; __file__='"'"'C:\\Users\\CSUFTitan\\AppData\\Local\\Temp\\pip-install-1nbc6jyl\\psycopg2-binary\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\CSUFTitan\AppData\Local\Temp\pip-record-k_sqf8bd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\csuftitan\desktop\final_starter\env\include\site\python3.8\psycopg2-binary' 

检查日志以获取完整的命令输出。

enter image description here

1 个答案:

答案 0 :(得分:0)

代替
pip install psycopg2
尝试运行
pip install psycopg2-binary

pip install psycopg2-binary --user

您可以在此处找到psycopg2的编译版本:http://www.lfd.uci.edu/~gohlke/pythonlibs/ 从此链接下载二进制文件并执行easy_install。