Reputation: 8080
I have multiple Python versions, and thus also include multiple Python binary executables.
ls /usr/bin/python*
shows the python environments in my ubuntu 18.04
/usr/bin/python /usr/bin/python2.7 /usr/bin/python2-pbr /usr/bin/python3 /usr/bin/python3.5m /usr/bin/python3.6-config /usr/bin/python3.6m-config /usr/bin/python3m
/usr/bin/python2 /usr/bin/python2-jsonschema /usr/bin/python2-wsdump /usr/bin/python3.5 /usr/bin/python3.6 /usr/bin/python3.6m /usr/bin/python3-config /usr/bin/python3m-config
in order to satisfy the PyFlink requirement regarding the Python environment version, i have to choose to soft link python to point to your python3 interpreter:
ln -s /usr/bin/python3 python
however when I use the command, it tells me
ln: failed to create symbolic link 'python': File exists
so i wonder do I need to delete the /usr/bin/python first and then use the command to create the soft link?
Upvotes: 1
Views: 2093
Reputation: 2407
Command ln -s /usr/bin/python3 python
creates link ./python
pointing to /usr/bin/python3
. You probably executed it multiple times so ./python
already exists. You could overwrite it by providing -f
flag to ln
.
You definitely should not delete /usr/bin/python
.
The whole idea with manually creating links to Python interpreter to install a package seems very weird. I suggest one of the following options:
/usr/bin/python3.6 -m pip install <package>
; if the package adds any scripts globally usable from command line, like pyspark
, they will be installed with hashbang pointing to the interpreter you installed them with/usr/bin/python3.6 -m venv ~/.env-py36; source ~/.env-py36/bin/activate; python -m pip install <package>
Upvotes: 4