Запуск файла py с 32-битным python из 64-битного python с модулем подпроцесса, но подпроцесс не может импортировать другой модуль (например, numpy) - PullRequest
0 голосов
/ 30 мая 2020

У меня установлена ​​python версия 3.7 и 3.6 на anaconda env.

Я пытаюсь запустить версию python 3.7 с 64-битной версией и использовать модуль подпроцесса для запуска python 32-битной версии на anaconda env.

Вот код моего первого скрипта, использующего подпроцесс и работает python 32bit

import sys
print("Python version")
print (sys.version)

import subprocess
path = 'C:\\Users\\punk\\Anaconda3\\envs\\py36_32\\python.exe'
subprocess.run([path, 'Update_daily_32bit.py'])

и .py, который я хочу запустить как 32bit python, начинается с

import numpy as np

, но я получаю сообщение об ошибке

C:\Users\punk\Anaconda3\envs\py36_32\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init
Traceback (most recent call last):
  File "Update_daily_32bit.py", line 6, in <module>
    import pandas as pd
  File "C:\Users\punk\Anaconda3\envs\py36_32\lib\site-packages\pandas\__init__.py", line 17, in <module>
    "Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.6 from "C:\Users\punk\Anaconda3\envs\py36_32\python.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.18.1" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: DLL load failed

Я удалил и переустановил numpy, но проблема не решена

Если я активирую py36_32 и запускаю скрипт, он работает, но если я перейду на python64bit и запустил первый скрипт, он не сработает.

Заранее спасибо.

...