Reputation: 1
Python throwing an error when I try to import epipy even though I installed the package to the project interpreter (python file's interpreter is also set to same environment)
Tried using an absolute import; from epipy import *
Tried importing a specific function e.g. from epipy import case_tree
Tried uninstalling and reinstalling the package
My code:
import pandas as pd
import epipy
I expect to import installed packages with no errors, received error below:
/Users/Noelle/Python/stats/bin/python /Users/Noelle/Python/stats/basic_analytics.py
Traceback (most recent call last):
File "/Users/Noelle/Python/stats/basic_analytics.py", line 2, in <module>
import epipy
File "/Users/Noelle/Python/stats/lib/python3.6/site-packages/epipy/__init__.py", line 5, in <module>
from .analyses import generation_analysis, reproduction_number, create_2x2
File "/Users/Noelle/Python/stats/lib/python3.6/site-packages/epipy/analyses.py", line 88
print 'Summary of reproduction numbers'
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Summary of reproduction numbers')?
Process finished with exit code 1
Upvotes: 0
Views: 149
Reputation: 21
That error is because print is being called:
print'Summary of reproduction numbers'
Instead of:
print('Summary of reproduction numbers')
Python 3 print syntax is different from python 2
EDIT: Seems this is because the epipy package you installed is for python 2 and not python 3
Upvotes: 0
Reputation: 5955
Did you install from pip or directly from github? According to this post, the pip version is only compatible with python 2, for py3.x you have to download the github version directly
Upvotes: 2