Mix-up of set path: Python 2.7 and 3.5. How to set it right?










0















Coming back to an old problem. The cause of the problem could be the path set. This is what I get from pprint(sys.path)



import sys 
from pprint import pprint
pprint(sys.path)
['',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3.5',
'/usr/local/lib/python2.7/dist-packages', (comment: 2.7 appears)
'/usr/lib/python2.7', (comment: again 2.7 appears)
'/usr/lib/python35.zip',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/usr/lib/python3/dist-packages']


Seems like a mix-up of Python 3.5 and 2.7 in set-path. There must be something similar to message would show for 2.7 also with the same command as the above. But can not check, as $python2.7 command itself can not be executed, ended up with error message.



Any help would be very much appreciated. I am working on a Linux ubuntu 16.04, Docker container.










share|improve this question
























  • What is the value of PYTHONPATH?

    – Travis Clarke
    Nov 13 '18 at 8:01











  • Can you share the Dockerfile that built the image? It's unusual to have more than one version of Python in a container at all.

    – David Maze
    Nov 13 '18 at 11:41











  • >>> import sys >>> print(sys.path) ['', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3.5', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python35.zip', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages']

    – Debacs
    Nov 15 '18 at 4:41












  • Sorry, not sure how to share the docker file. I am using docker for the first time. In the main device both 2.7 and 3.5 exists and there is no conflict. I have tried with deleting my container. But when created a new, it gives similar problem. Refreshing is not a problem for me, as I don't have many important files there. And I can install necessary packages again. I just want a clean environment.

    – Debacs
    Nov 15 '18 at 4:49















0















Coming back to an old problem. The cause of the problem could be the path set. This is what I get from pprint(sys.path)



import sys 
from pprint import pprint
pprint(sys.path)
['',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3.5',
'/usr/local/lib/python2.7/dist-packages', (comment: 2.7 appears)
'/usr/lib/python2.7', (comment: again 2.7 appears)
'/usr/lib/python35.zip',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/usr/lib/python3/dist-packages']


Seems like a mix-up of Python 3.5 and 2.7 in set-path. There must be something similar to message would show for 2.7 also with the same command as the above. But can not check, as $python2.7 command itself can not be executed, ended up with error message.



Any help would be very much appreciated. I am working on a Linux ubuntu 16.04, Docker container.










share|improve this question
























  • What is the value of PYTHONPATH?

    – Travis Clarke
    Nov 13 '18 at 8:01











  • Can you share the Dockerfile that built the image? It's unusual to have more than one version of Python in a container at all.

    – David Maze
    Nov 13 '18 at 11:41











  • >>> import sys >>> print(sys.path) ['', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3.5', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python35.zip', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages']

    – Debacs
    Nov 15 '18 at 4:41












  • Sorry, not sure how to share the docker file. I am using docker for the first time. In the main device both 2.7 and 3.5 exists and there is no conflict. I have tried with deleting my container. But when created a new, it gives similar problem. Refreshing is not a problem for me, as I don't have many important files there. And I can install necessary packages again. I just want a clean environment.

    – Debacs
    Nov 15 '18 at 4:49













0












0








0








Coming back to an old problem. The cause of the problem could be the path set. This is what I get from pprint(sys.path)



import sys 
from pprint import pprint
pprint(sys.path)
['',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3.5',
'/usr/local/lib/python2.7/dist-packages', (comment: 2.7 appears)
'/usr/lib/python2.7', (comment: again 2.7 appears)
'/usr/lib/python35.zip',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/usr/lib/python3/dist-packages']


Seems like a mix-up of Python 3.5 and 2.7 in set-path. There must be something similar to message would show for 2.7 also with the same command as the above. But can not check, as $python2.7 command itself can not be executed, ended up with error message.



Any help would be very much appreciated. I am working on a Linux ubuntu 16.04, Docker container.










share|improve this question
















Coming back to an old problem. The cause of the problem could be the path set. This is what I get from pprint(sys.path)



import sys 
from pprint import pprint
pprint(sys.path)
['',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3.5',
'/usr/local/lib/python2.7/dist-packages', (comment: 2.7 appears)
'/usr/lib/python2.7', (comment: again 2.7 appears)
'/usr/lib/python35.zip',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/usr/lib/python3/dist-packages']


Seems like a mix-up of Python 3.5 and 2.7 in set-path. There must be something similar to message would show for 2.7 also with the same command as the above. But can not check, as $python2.7 command itself can not be executed, ended up with error message.



Any help would be very much appreciated. I am working on a Linux ubuntu 16.04, Docker container.







python linux docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 0:42







Debacs

















asked Nov 13 '18 at 7:45









DebacsDebacs

42




42












  • What is the value of PYTHONPATH?

    – Travis Clarke
    Nov 13 '18 at 8:01











  • Can you share the Dockerfile that built the image? It's unusual to have more than one version of Python in a container at all.

    – David Maze
    Nov 13 '18 at 11:41











  • >>> import sys >>> print(sys.path) ['', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3.5', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python35.zip', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages']

    – Debacs
    Nov 15 '18 at 4:41












  • Sorry, not sure how to share the docker file. I am using docker for the first time. In the main device both 2.7 and 3.5 exists and there is no conflict. I have tried with deleting my container. But when created a new, it gives similar problem. Refreshing is not a problem for me, as I don't have many important files there. And I can install necessary packages again. I just want a clean environment.

    – Debacs
    Nov 15 '18 at 4:49

















  • What is the value of PYTHONPATH?

    – Travis Clarke
    Nov 13 '18 at 8:01











  • Can you share the Dockerfile that built the image? It's unusual to have more than one version of Python in a container at all.

    – David Maze
    Nov 13 '18 at 11:41











  • >>> import sys >>> print(sys.path) ['', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3.5', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python35.zip', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages']

    – Debacs
    Nov 15 '18 at 4:41












  • Sorry, not sure how to share the docker file. I am using docker for the first time. In the main device both 2.7 and 3.5 exists and there is no conflict. I have tried with deleting my container. But when created a new, it gives similar problem. Refreshing is not a problem for me, as I don't have many important files there. And I can install necessary packages again. I just want a clean environment.

    – Debacs
    Nov 15 '18 at 4:49
















What is the value of PYTHONPATH?

– Travis Clarke
Nov 13 '18 at 8:01





What is the value of PYTHONPATH?

– Travis Clarke
Nov 13 '18 at 8:01













Can you share the Dockerfile that built the image? It's unusual to have more than one version of Python in a container at all.

– David Maze
Nov 13 '18 at 11:41





Can you share the Dockerfile that built the image? It's unusual to have more than one version of Python in a container at all.

– David Maze
Nov 13 '18 at 11:41













>>> import sys >>> print(sys.path) ['', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3.5', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python35.zip', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages']

– Debacs
Nov 15 '18 at 4:41






>>> import sys >>> print(sys.path) ['', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3.5', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python35.zip', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages']

– Debacs
Nov 15 '18 at 4:41














Sorry, not sure how to share the docker file. I am using docker for the first time. In the main device both 2.7 and 3.5 exists and there is no conflict. I have tried with deleting my container. But when created a new, it gives similar problem. Refreshing is not a problem for me, as I don't have many important files there. And I can install necessary packages again. I just want a clean environment.

– Debacs
Nov 15 '18 at 4:49





Sorry, not sure how to share the docker file. I am using docker for the first time. In the main device both 2.7 and 3.5 exists and there is no conflict. I have tried with deleting my container. But when created a new, it gives similar problem. Refreshing is not a problem for me, as I don't have many important files there. And I can install necessary packages again. I just want a clean environment.

– Debacs
Nov 15 '18 at 4:49












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53276131%2fmix-up-of-set-path-python-2-7-and-3-5-how-to-set-it-right%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53276131%2fmix-up-of-set-path-python-2-7-and-3-5-how-to-set-it-right%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin