I'm using AnyTree in an independent environment where there is no pip (testcomplete).
I started by moving the anytree folders to the required folders, and started getting import error for six. I downloaded six and placed it in as well, and now I get:
'module' object has no attribute 'iterator'
In case anyone is interested - this is the code for doing this without pip:
from os import sys
sys.path.insert(0, "C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python34\Lib\site-packages")
import six
import anytree
udo = anytree.Node("Udo")
print(udo)
Any ideas on how to fix this? Google only returned this result: __builtin__.iterator does not exist?
The only two options I can think of are - moving the folders physically (tried but given the error above) or installing through a script:
It doesn't seem to work either (on 2.7 and I tried an updated script on 3.6 but neither work).
import sys
import os
import site
from importlib import reload
try:
import pip
except ImportError:
print "installing pip"
cmd = "sudo easy_install pip"
os.system(cmd)
reload(site)
try:
import requests
except ImportError:
print "no lib requests"
import pip
cmd = "sudo pip install requests"
print "Requests package is missing\nPlease enter root password to install required package"
os.system(cmd)
reload(site)
I wrote something similar before and you are on the right track. Instead of
cmd = "sudo easy_install pip"
you need to try
cmd = "get-pip.py"
and have it point to the file you can download here https://bootstrap.pypa.io/get-pip.py .
Also, you can run pip from the command line in windows, no need to be in a python terminal. Like So:
pip install requests
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.