Support python 2.7

This commit is contained in:
Shangtong Zhang
2018-05-07 12:17:16 -06:00
parent a6bcf9e5a7
commit 8e11d762e7
3 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ Prediction is sampled after 110K iterations, and I only implemented one-step tra
# Dependency
* MacOS 10.12 or Ubuntu 16.04
* PyTorch v0.4.0
* Python 3.5 or 3.6
* Python 3.6, 3.5 or 2.7 (deprecated)
* Core dependencies: `pip install -r requirements.txt`
* Optional: [Roboschool](https://github.com/openai/roboschool), [DeepMind Control Suite](https://github.com/deepmind/dm_control)+[DMControl2Gym](dm_control2gym)
+2 -1
View File
@@ -7,5 +7,6 @@ tensorboardX==1.1
scikit-image>=0.13.1
tqdm>=4.23.0
pandas>=0.22.0
pathlib>=1.0.1
pathlib2>=1.0.1;python_version <= '2.7'
pathlib>=1.0.1;python_version >= '3.5'
seaborn>=0.8.1
+7 -2
View File
@@ -9,8 +9,13 @@ import pickle
import os
import datetime
import uuid
import pathlib
import torch
try:
# python >= 3.5
from pathlib import Path
except:
# python == 2.7
from pathlib2 import Path
def run_episodes(agent):
config = agent.config
@@ -83,7 +88,7 @@ def sync_grad(target_network, src_network):
param._grad = src_param.grad.clone()
def mkdir(path):
pathlib.Path(path).mkdir(parents=True, exist_ok=True)
Path(path).mkdir(parents=True, exist_ok=True)
def set_one_thread():
os.environ['OMP_NUM_THREADS'] = '1'