簡體   English   中英

如何設置創建 gen_py 的路徑 (win32com.__gen_path__)

[英]How do I set the path where gen_py is created (win32com.__gen_path__)

我正在嘗試在 Python 中運行 Python 子進程。 具體來說是WinPython 3.6.1.0 我在公司 PC 上,因此 Python 未安裝在C:\Program Files中,而是安裝在自定義文件夾中。

我是這樣開始的:

envs = {'SYSTEMROOT': r'C:\Windows', 'PATH': config.path_python}
subprocess.run('pip.exe install -e . --no-deps', shell=True, env=envs)
FileNotFoundError: [Errno 2] No such file or directory: 
    'C:\\WINDOWS\\gen_py\\3.6\\__init__.py'

我的猜測:它試圖將gen_py寫入沒有寫入權限r'C:\Windows' ,但隨后無法讀取它。 我想通過刪除 SYSTEMROOT 來修復它,但后來我得到了

Fatal Python error: failed to get random numbers to initialize Python

來自谷歌: 1 2 我嘗試將%APPDATA%設置為可寫文件夾( 'APPDATA': r'C:\Users\MyUser\AppData\Roaming' )但沒有骰子:/

我只需要在我的envs字典中添加一個TEMP鍵。 現在看起來像這樣:

envs = {
    'SYSTEMROOT': r'C:\Windows', 
    'TEMP': r'C:\Users\MyUser\AppData\Local\Temp',
    'PATH': config.path_python
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM