It seems to automatically use the latest version, and I haven't been able to find the answer in the pyinstaller documentation.
It complains that my python2 code has incorrect syntax but it does not.
Traceback (most recent call last):
File "/usr/bin/pyinstaller", line 11, in <module>
load_entry_point('PyInstaller==3.2', 'console_scripts', 'pyinstaller')()
File "/usr/lib/python3.5/site-packages/PyInstaller/__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/lib/python3.5/site-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/usr/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 212, in __init__
self.__postinit__()
File "/usr/lib/python3.5/site-packages/PyInstaller/building/datastruct.py", line 178, in __postinit__
self.assemble()
File "/usr/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 413, in assemble
priority_scripts.append(self.graph.run_script(script))
File "/usr/lib/python3.5/site-packages/PyInstaller/depend/analysis.py", line 144, in run_script
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "/usr/lib/python3.5/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 888, in run_script
co_ast = compile(contents, pathname, 'exec', ast.PyCF_ONLY_AST, True)
File "/home/chuck/Pictures/testpics/photoresize.py", line 59
print "incorrect options please choose from d(irectory),s(ize),e(xtension),r(ecursive) or use defaults"
^
SyntaxError: invalid syntax
Perhaps use virtualenv , or virtualenvwrapper With virtualenv it's possible to create separate environments with different versions of Python. virtualenvwrapper is wrapper for virtualenv some how easier to work with.
Since you're not willing to install a virtual environment as you commented, an easy workaround would be:
/usr/local/lib/python2.7
PATH=/usr/local/lib/python2.7:$PATH
python --version
just to check that it says V2 something not V3 python
prefix That doesn't affect system path (local to the console), so no need to revert back to previous path settings. Just close the console when you're done.
Also, don't use sudo
as it's not needed and it changes/resets the path, which was your problem as you confirmed.
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.