无法使用pip

时间:2017-02-20 19:31:50

标签: python powershell sqlalchemy scrapy

我正在使用有关Python中的网页抓取脚本的教程http://newcoder.io/scrape/part-0/。我被困住了:

您应该在提示之前看到(ScrapeProj)。现在使用以下命令为此项目安装包需求。

(ScrapeProj) $ pip install -r requirements.txt"

输入pip install -r requirements.txt之后是代码:

(ScrapeProj)PS C:\Projects\new-coder\scrape> pip install -r requirements.txt
Collecting SQLAlchemy==0.9.8 (from -r requirements.txt (line 1))
  Using cached SQLAlchemy-0.9.8.tar.gz
Collecting Scrapy==0.24.4 (from -r requirements.txt (line 2))
Collecting psycopg2==2.5.4 (from -r requirements.txt (line 3))
  Using cached psycopg2-2.5.4.tar.gz
Requirement already satisfied: six>=1.5.2 in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: lxml in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from Scrapy==0.24.4->-r requirements.txt (line 2))
Collecting Twisted>=10.0.0 (from Scrapy==0.24.4->-r requirements.txt (line 2))
  Using cached Twisted-17.1.0.tar.bz2
Requirement already satisfied: pyOpenSSL in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: queuelib in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: cssselect>=0.9 in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: w3lib>=1.8.0 in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from Scrapy==0.24.4->-r requirements.txt (line 2))
Collecting zope.interface>=4.0.2 (from Twisted>=10.0.0->Scrapy==0.24.4->-r requirements.txt (line 2))
  Using cached zope.interface-4.3.3.tar.gz
Collecting constantly>=15.1 (from Twisted>=10.0.0->Scrapy==0.24.4->-r requirements.txt (line 2))
  Using cached constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from Twisted>=10.0.0->Scrapy==0.24.4->-r requirements.txt (line 2))
  Using cached incremental-16.10.1-py2.py3-none-any.whl
Collecting Automat>=0.3.0 (from Twisted>=10.0.0->Scrapy==0.24.4->-r requirements.txt (line 2))
  Using cached Automat-0.5.0-py2.py3-none-any.whl
Requirement already satisfied: cryptography>=1.3.4 in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from pyOpenSSL->Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: setuptools in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from zope.interface>=4.0.2->Twisted>=10.0.0->Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: attrs in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from Automat>=0.3.0->Twisted>=10.0.0->Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: cffi>=1.4.1 in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: pyasn1>=0.1.8 in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: idna>=2.0 in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->Scrapy==0.24.4->-r requirements.txt (line 2))
Requirement already satisfied: pycparser in c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages (from cffi>=1.4.1->cryptography>=1.3.4->pyOpenSSL->Scrapy==0.24.4->-r requirements.txt (line 2))
Building wheels for collected packages: SQLAlchemy, psycopg2, Twisted, zope.interface
  Running setup.py bdist_wheel for SQLAlchemy ... error
  Failed building wheel for SQLAlchemy
  Running setup.py clean for SQLAlchemy
  Failed cleaning build dir for SQLAlchemy
  Running setup.py bdist_wheel for psycopg2 ... error
  Complete output from command c:\users\michał\.virtualenvs\scrapeproj\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\MICHA~1\\AppData\\Local\\Temp\\pip-build-tbrjowi1\\psycopg2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.rea
d().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\MICHA~1\AppData\Local\Temp\tmpdmqpgmbkpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\psycopg2
  copying lib\errorcodes.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\extensions.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\extras.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\pool.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\psycopg1.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\tz.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\_json.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\_range.py -> build\lib.win-amd64-3.6\psycopg2
  copying lib\__init__.py -> build\lib.win-amd64-3.6\psycopg2
  creating build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\dbapi20.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\dbapi20_tpc.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\testconfig.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\testutils.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_async.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_bugX000.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_bug_gc.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_cancel.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_connection.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_copy.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_cursor.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_dates.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_extras_dictcursor.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_green.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_lobject.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_module.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_notify.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_psycopg2_dbapi20.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_quote.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_transaction.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_types_basic.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_types_extras.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\test_with.py -> build\lib.win-amd64-3.6\psycopg2\tests
  copying tests\__init__.py -> build\lib.win-amd64-3.6\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
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  creating build\temp.win-amd64-3.6\Release\psycopg
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPSYCOPG_DEFAULT_PYDATETIME=1 "-DPSYCOPG_VERSION=\"2.5.4 (dt dec pq3 ext)\"" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_
HEX=0x090602 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -Ic:\python36\include -Ic:\python36\include -I. -IC:/PROGRA~1/POSTGR~1/9.6/include -IC:/PROGRA~1/POSTGR~1/9.6/include/server "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE"
"-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcpsycopg\psycopgmodule.c /Fo
build\temp.win-amd64-3.6\Release\psycopg\psycopgmodule.obj
  psycopgmodule.c
  .\psycopg/config.h(134): warning C4005: 'isnan': macro redefinition
  C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\math.h(264): note: see previous definition of 'isnan'
  .\psycopg/config.h(138): warning C4005: 'isinf': macro redefinition
  C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\math.h(263): note: see previous definition of 'isinf'
  .\psycopg/config.h(150): error C2491: 'round': definition of dllimport function not allowed
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
  Running setup.py bdist_wheel for Twisted ... error
  Failed building wheel for Twisted
  Running setup.py clean for Twisted
  Running setup.py bdist_wheel for zope.interface ... error
  Failed building wheel for zope.interface
  Running setup.py clean for zope.interface
Failed to build SQLAlchemy psycopg2 Twisted zope.interface
Installing collected packages: SQLAlchemy, zope.interface, constantly, incremental, Automat, Twisted, Scrapy, psycopg2
  Running setup.py install for SQLAlchemy ... error
Exception:
Traceback (most recent call last):
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 199: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 199: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\commands\install.py", line 385, in run
    requirement_set.cleanup_files()
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\req\req_set.py", line 729, in cleanup_files
    req.remove_temporary_source()
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\req\req_install.py", line 977, in remove_temporary_source
    rmtree(self.source_dir)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\six.py", line 686, in reraise
    raise value
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\utils\__init__.py", line 102, in rmtree
    onerror=rmtree_errorhandler)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\shutil.py", line 488, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\shutil.py", line 387, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\utils\__init__.py", line 114, in rmtree_errorhandler
    func(path)
PermissionError: [WinError 32] Proces nie może uzyskać dostępu do pliku, ponieważ jest on używany przez inny proces: 'C:\\Users\\MICHA~1\\AppData\\Local\\Temp\\pip-build-tbrjowi1\\SQLAlchemy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\commands\install.py", line 385, in run
    requirement_set.cleanup_files()
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\utils\build.py", line 38, in __exit__
    self.cleanup()
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\utils\build.py", line 42, in cleanup
    rmtree(self.name)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\six.py", line 686, in reraise
    raise value
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\utils\__init__.py", line 102, in rmtree
    onerror=rmtree_errorhandler)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\shutil.py", line 488, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\shutil.py", line 378, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\shutil.py", line 387, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "c:\users\michał\.virtualenvs\scrapeproj\lib\site-packages\pip\utils\__init__.py", line 114, in rmtree_errorhandler
    func(path)
PermissionError: [WinError 32] Proces nie może uzyskać dostępu do pliku, ponieważ jest on używany przez inny proces: 'C:\\Users\\MICHA~1\\AppData\\Local\\Temp\\pip-build-tbrjowi1\\SQLAlchemy'
(ScrapeProj)PS C:\Projects\new-coder\scrape>

最后一行是波兰语

PermissionError: [WinError 32] Proces nie może uzyskać dostępu do pliku, ponieważ jest on używany przez inny proces: 'C:\\Users\\MICHA~1\\AppData\\Local\\Temp\\pip-build-tbrjowi1\\SQLAlchemy'

这意味着:

PermissionError: [WinError 32] Process can't get access to file because the file is being used by other process: 'C:\\Users\\MICHA~1\\AppData\\Local\\Temp\\pip-build-tbrjowi1\\SQLAlchemy'

我的规格是:

  • Windows 10 64位专业版
  • Python 3.6.0
  • Powershell以管理员身份运行
  • appdirs == 1.4.0
  • ATTRS == 16.3.0
  • CFFI == 1.9.1
  • 加密== 1.7.2
  • cssselect == 1.0.1
  • IDNA == 2.2
  • LXML == 3.7.3
  • 包装== 16.8
  • parsel == 1.1.0
  • psycopg2 == 2.6.2
  • pyasn1 == 0.2.2
  • pyasn1模块== 0.0.8
  • pycparser == 2.17
  • PyDispatcher == 2.0.5
  • pyOpenSSL == 16.2.0
  • pyparsing == 2.1.10
  • queuelib == 1.4.2
  • 服务标识== 16。
  • 6 == 1.10.0
  • w3lib == 1.17.0

任何人都可以帮我解决这个问题吗?我是Python的新手,但我已经遇到了很多麻烦,因为我没有想法。尝试分别安装车轮和那些库,但没有任何帮助。

0 个答案:

没有答案