pythonterminalpippycharmcall-graph

Unable to run python package (viztracer) from terminal


I installed code2flow through pip install. But I'm unable to run my python script on viztracer in the terminal.

pip3 install viztracer 
viztracer mypythonfile.py

I'm using PyCharm's internal Terminal.

Getting the below error:

viztracer : The term 'viztracer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, 
verify that the path is correct and try again.

enter image description here

Can anyone help on this?

mypythonfile.py

import flask
from flask import request
app = flask.Flask(__name__)

@app.route("/binary_search", methods=["POST"])
def binary_search():


my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
target = request.form.get("target")
print("target: {}".format(target))
target = int(target)
first = 0
last = len(my_list) - 1
found = False

while first <= last and not found:
    midpoint = (first + last) // 2
    if my_list[midpoint] == target:
        found = True
    else:
        if target < my_list[midpoint]:
            last = midpoint - 1
        else:
            first = midpoint + 1

return flask.jsonify(found)

if __name__ == "__main__":
app.run(host='0.0.0.0', port=2000, debug=False)

EDIT: Corrected the question.


Solution

  • The directory C:\users\hreka\appdata\roaming\python37\Scripts is probably not part of your PATH environment variable. You need to add it:

    1. Run rundll32 sysdm.cpl,EditEnvironmentVariables
    2. Select PATH and hit the Edit button
    3. In the new window, select new, paste C:\users\hreka\appdata\roaming\python37\Scripts and then select Ok
    4. Restart your system