Однако когда я использую команду:
Код: Выделить всё
python -m venv .venv
У меня:
- Проверено, что глобальная установка Python включает python3.13t.exe.
- Проверил .venv , но в нем есть только каталог по умолчанию. python.exe.
- Попытка явно указать интерпретатор, используя:
Код: Выделить всё
python -m venv --copies .venv
Изменить:
Также попробовал использовать следующую команду:
Код: Выделить всё
python3.13t -m venv .venv
Это ожидаемое поведение при создании виртуальной среды с Python 3.13 в режиме со свободным потоком? Если нет, то как я могу гарантировать, что виртуальная среда включает только интерпретатор python3.13t.exe или, по крайней мере, правильно отличает его от Python.exe по умолчанию?
Изменить 2 :
код, который я пытаюсь запустить
Код: Выделить всё
import aiohttp
import asyncio
import sys
import time
async def fetch_data(session, url):
"""
Fetch data from a given URL using an aiohttp session.
"""
try:
async with session.get(url) as response:
data = await response.text()
print(f"Data fetched from {url[:30]}... (length: {len(data)})")
return data
except Exception as e:
print(f"Failed to fetch data from {url}: {e}")
return None
async def main():
"""
Main coroutine to manage the asynchronous fetching of data.
"""
urls = [
"https://jsonplaceholder.typicode.com/posts",
"https://jsonplaceholder.typicode.com/comments",
"https://jsonplaceholder.typicode.com/albums",
"https://jsonplaceholder.typicode.com/photos",
"https://jsonplaceholder.typicode.com/todos",
]
async with aiohttp.ClientSession() as session:
# Create tasks for fetching data from all URLs
tasks = [fetch_data(session, url) for url in urls]
# Gather results asynchronously
results = await asyncio.gather(*tasks)
print("\nAll tasks completed!")
for idx, result in enumerate(results):
print(f"Result {idx + 1} length: {len(result) if result else 'Failed'}")
# Run the main event loop
if __name__ == "__main__":
if sys._is_gil_enabled():
print("GIL enabled")
else:
print("GIL disabled")
t1 = time.time()
asyncio.run(main())
t2 = time.time()
print(f"Execution time: {t2-t1:.2f}s")
выполнение кода ничего не выводит
Подробнее здесь: https://stackoverflow.com/questions/793 ... on-windows
Мобильная версия