在没有internet连接的计算机上创建虚拟环境

2024-10-02 16:21:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在一台网络连接有限的机器上使用pipenv。当我运行pipenv install时,它会创建pipfile。但当它试图创造虚拟世界时,它只是停下来思考。有没有可能创建一个virtualenv而不尝试连接到internet?你知道吗

Creating a virtualenv for this project…
Pipfile: C:\Users\habr08\Utveckling\Python\Projects\Tensorflow\Pipfile
Using c:\program files (x86)\python37-32\python.exe (3.7.2) to create 
virtualenv…
[=   ] Creating virtual environment...

最后我得到了这个错误信息

FAIL
['Traceback (most recent call last):\n', '  File 
"C:\\Users\\habr08\\AppData\\Roaming\\Python\\Python37\\site- 
packages\\pipenv\\vendor\\vistir\\contextmanagers.py", line 150, in 
spinner\n    yield _spinner\n', '  File 
"C:\\Users\\habr08\\AppData\\Roaming\\Python\\Python37\\site- 
packages\\pipenv\\vendor\\vistir\\misc.py", line 314, in run\n    
write_to_stdout=True\n', '  File 
"C:\\Users\\habr08\\AppData\\Roaming\\Python\\Python37\\site- 
packages\\pipenv\\vendor\\vistir\\misc.py", line 236, in 
_create_subprocess\n    c.out, c.err = c.communicate()\n', '  File 
"c:\\program files (x86)\\python37-32\\lib\\subprocess.py", line 939, in 
communicate\n    stdout, stderr = self._communicate(input, endtime, 
timeout)\n', '  File "c:\\program files (x86)\\python37- 
32\\lib\\subprocess.py", line 1267, in _communicate\n    
self.stdout_thread.join(self._remaining_time(endtime))\n', '  File 
"c:\\program files (x86)\\python37-32\\lib\\threading.py", line 1032, in 
join\n    self._wait_for_tstate_lock()\n', '  File "c:\\program files 
(x86)\\python37-32\\lib\\threading.py", line 1048, in 
_wait_for_tstate_lock\n    elif lock.acquire(block, timeout):\n', '  File 
"C:\\Users\\habr08\\AppData\\Roaming\\Python\\Python37\\site- 
packages\\pipenv\\vendor\\yaspin\\signal_handlers.py", line 23, in 
default_handler\n    sys.exit(0)\n', 'SystemExit: 0\n']
c:\program files (x86)\python37-32\lib\subprocess.py:858: ResourceWarning: 
subprocess 4504 is still running
ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

Tags: inpyselflibpipenvlinefilesprogram