我正在使用Python 3.11.3,从requirements.txt文件安装时遇到了困难,这是我的输出:
2023-05-09 10:04:59.539 [info] Running Env creation script: [
'c:\\Users\\alex\\AppData\\Local\\Programs\\Python\\Python311\\python.exe',
'c:\\Users\\alex\\.vscode\\extensions\\ms-python.python-2023.8.0\\pythonFiles\\create_venv.py',
'--git-ignore',
'--requirements',
'c:\\Coding\\api\\requirements.txt'
]
2023-05-09 10:04:59.830 [info] EXISTING_VENV:c:\Coding\api\.venv\Scripts\python.exe
CREATE_VENV.UPGRADING_PIP
Running: c:\Coding\api\.venv\Scripts\python.exe -m pip install --upgrade pip
2023-05-09 10:05:01.188 [info] Requirement already satisfied: pip in c:\coding\api\.venv\lib\site-packages (23.1.2)
2023-05-09 10:05:01.701 [info] CREATE_VENV.UPGRADED_PIP
VENV_INSTALLING_REQUIREMENTS: ['c:\\Coding\\api\\requirements.txt']
VENV_INSTALLING_REQUIREMENTS: c:\Coding\api\requirements.txt
Running: c:\Coding\api\.venv\Scripts\python.exe -m pip install -r c:\Coding\api\requirements.txt
2023-05-09 10:05:03.181 [info] Collecting asgiref==3.6.0 (from -r c:\Coding\api\requirements.txt (line 1))
2023-05-09 10:05:03.195 [info] Using cached asgiref-3.6.0-py3-none-any.whl (23 kB)
2023-05-09 10:05:03.281 [info] Collecting autopep8==2.0.2 (from -r c:\Coding\api\requirements.txt (line 2))
2023-05-09 10:05:03.296 [info] Using cached autopep8-2.0.2-py2.py3-none-any.whl (45 kB)
2023-05-09 10:05:03.361 [info] Collecting distlib==0.3.6 (from -r c:\Coding\api\requirements.txt (line 3))
2023-05-09 10:05:03.379 [info] Using cached distlib-0.3.6-py2.py3-none-any.whl (468 kB)
2023-05-09 10:05:03.579 [info] Collecting Django==4.2.1 (from -r c:\Coding\api\requirements.txt (line 4))
2023-05-09 10:05:03.807 [info] Downloading Django-4.2.1-py3-none-any.whl (8.0 MB)
2023-05-09 10:05:19.573 [info]
2023-05-09 10:05:19.574 [info] --- 0.6/8.0 MB 819.2 kB/s eta 0:00:09
2023-05-09 10:05:19.574 [info]
2023-05-09 10:05:19.596 [info] ERROR: Exception:
Traceback (most recent call last):
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
yield
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 561, in read
data = self._fp_read(amt) if not fp_closed else b""
^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 527, in _fp_read
return self._fp.read(amt) if amt is not None else self._fp.read()
^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 90, in read
data = self.__fp.read(amt)
^^^^^^^^^^^^^^^^^^^
File "c:\Users\alex\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 466, in read
s = self.fp.read(amt)
^^^^^^^^^^^^^^^^^
File "c:\Users\alex\AppData\Local\Programs\Python\Python311\Lib\socket.py", line 706, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\alex\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1278, in recv_into
return self.read(nbytes, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\alex\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1134, in read
return self._sslobj.read(len, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 169, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 248, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\commands\install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\resolvelib\structs.py", line 156, in __bool__
return bool(self._sequence)
^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 155, in __bool__
return any(self)
^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
candidate = func()
^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 206, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 293, in __init__
super().__init__(
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
self.dist = self._prepare()
^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 225, in _prepare
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 304, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 516, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 587, in _prepare_linked_requirement
local_file = unpack_url(
^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 166, in unpack_url
file = get_http_url(
^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 107, in get_http_url
from_path, content_type = download(link, temp_dir.path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\network\download.py", line 147, in __call__
for chunk in chunks:
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\cli\progress_bars.py", line 53, in _rich_progress_bar
for chunk in iterable:
File "c:\Coding\api\.venv\Lib\site-packages\pip\_internal\network\utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 622, in stream
data = self.read(amt=amt, decode_content=decode_content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 560, in read
with self._error_catcher():
File "c:\Users\alex\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "c:\Coding\api\.venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 443, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
2023-05-09 10:05:19.798 [info] Traceback (most recent call last):
File "c:\Users\alex\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\create_venv.py", line 77, in run_process
2023-05-09 10:05:19.798 [info] subprocess.run(args, cwd=os.getcwd(), check=True)
File "c:\Users\alex\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 571, in run
2023-05-09 10:05:19.799 [info] raise CalledProcessError(retcode, process.args,
2023-05-09 10:05:19.800 [info] subprocess.CalledProcessError: Command '['c:\\Coding\\api\\.venv\\Scripts\\python.exe', '-m', 'pip', 'install', '-r', 'c:\\Coding\\api\\requirements.txt']' returned non-zero exit status 2.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\alex\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\create_venv.py", line 232, in <module>
2023-05-09 10:05:19.801 [info]
2023-05-09 10:05:19.801 [info] main(sys.argv[1:])
File "c:\Users\alex\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\create_venv.py", line 228, in main
2023-05-09 10:05:19.802 [info] install_requirements(venv_path, args.requirements)
File "c:\Users\alex\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\create_venv.py", line 97, in install_requirements
2023-05-09 10:05:19.802 [info] run_process(
File "c:\Users\alex\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\create_venv.py", line 79, in run_process
2023-05-09 10:05:19.803 [info] raise VenvError(error_message)
VenvError: CREATE_VENV.PIP_FAILED_INSTALL_REQUIREMENTS
2023-05-09 10:05:19.838 [error] Error while running venv creation script: CREATE_VENV.PIP_FAILED_INSTALL_REQUIREMENTS
2023-05-09 10:05:19.839 [error] CREATE_VENV.PIP_FAILED_INSTALL_REQUIREMENTS
这就是我的requirements.txt:
asgiref==3.6.0
autopep8==2.0.2
distlib==0.3.6
Django==4.2.1
django-dotenv==1.4.2
environ==1.0
filelock==3.12.0
platformdirs==3.5.0
psycopg2-binary==2.9.6
pycodestyle==2.10.0
python-dotenv==1.0.0
sqlparse==0.4.4
tzdata==2023.3
virtualenv==20.23.0
1条答案
按热度按时间jucafojl1#
我发现问题是我的网络连接很差。谢谢你@404pio帮我解决这个问题。