|
@ -1,21 +1,25 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
# tzquant |
|
|
# tzquant |
|
|
|
|
|
|
|
|
|
|
|
import site |
|
|
import os |
|
|
import os |
|
|
import shutil |
|
|
import shutil |
|
|
import numpy as np |
|
|
import numpy as np |
|
|
|
|
|
|
|
|
# 定义要移动的目录列表 |
|
|
# 定义要移动的目录列表 |
|
|
directories_to_move = ['tz_ctastrategy', 'tzquant', 'tzqtdatahub', 'tz_riskmanager', 'gate_api', 'clients'] |
|
|
directories_to_move = ['tz_ctastrategy', 'tzquant', 'tzqtdatahub', 'tz_riskmanager', 'gate_api', 'clients'] |
|
|
|
|
|
|
|
|
# 获取numpy模块的__file__属性,它包含了numpy模块文件的路径 |
|
|
|
|
|
numpy_file_path = np.__file__ |
|
|
|
|
|
|
|
|
|
|
|
# 使用os.path模块来获取numpy所在的目录 |
|
|
|
|
|
numpy_dir = os.path.dirname(numpy_file_path) |
|
|
|
|
|
|
|
|
|
|
|
# 获取numpy所在目录的上层目录 |
|
|
|
|
|
parent_dir = os.path.dirname(numpy_dir) |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
# 获取numpy模块的__file__属性,它包含了numpy模块文件的路径 |
|
|
|
|
|
numpy_file_path = np.__file__ |
|
|
|
|
|
|
|
|
|
|
|
# 使用os.path模块来获取numpy所在的目录 |
|
|
|
|
|
numpy_dir = os.path.dirname(numpy_file_path) |
|
|
|
|
|
|
|
|
|
|
|
# 获取numpy所在目录的上层目录 |
|
|
|
|
|
parent_dir = os.path.dirname(numpy_dir) |
|
|
|
|
|
except Exception as e: |
|
|
|
|
|
parent_dir = os.path.dirname(site.getsitepackages()[0]+'/') |
|
|
|
|
|
print(f"Error: {e}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 打印上层目录,用于验证 |
|
|
# 打印上层目录,用于验证 |
|
|
print("NumPy所在目录的上层目录是: ", parent_dir) |
|
|
print("NumPy所在目录的上层目录是: ", parent_dir) |
|
|