Python Forum
sys.path for virtual environment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sys.path for virtual environment
#1
In a previous post I inquired about how to activate and use a virtual environment once the virtual environment is created
in the Jupyter notebook.

I can now get and use the virtual environment even in the jupyter notebook IDE. However when I try to import something
as basic as numpy it says numpy module not found.

Yet, I installed numpy and a simply pip list or conda list will confirm that.

Again, I am talking only the virtual environment, not the basic environment.

The response when I type

python -V in the virtual environment is

Python 3.611

That is exactly what I want.

But, when I type

import sys
print(sys.path)

I get the sys.path for the basic environment, not the virtual. There is a different version of python etc. That explains why it cannot find numpy in my virtual environment. It is looking in the wrong place.

How do I get the virtual environment system path? Maybe a better question is can I get and use the VE sys.path? If I can how do I do it?

Any help appreciated. thanks in advance.


Respectfully,

ErnestTBass
Reply


Messages In This Thread
sys.path for virtual environment - by ErnestTBass - Sep-10-2020, 05:45 PM
RE: sys.path for virtual environment - by bowlofred - Sep-10-2020, 06:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with creating folder and "virtual environment" AudunNilsen 1 251 Mar-21-2024, 04:41 AM
Last Post: deanhystad
  Installing python packages in a virtual environment Led_Zeppelin 1 776 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Problem with virtual environment standenman 2 1,017 Feb-23-2023, 07:09 PM
Last Post: standenman
Question Virtual Environment (using VS Code) Ashcora 4 14,196 Feb-15-2023, 07:17 PM
Last Post: snippsat
  How do I link the virtual environment of that project to the 3.9.2 version of python? Bryant11 1 1,382 Feb-26-2022, 11:15 AM
Last Post: Larz60+
  Project structure with a virtual environment gdbengo 1 1,453 Jan-26-2022, 03:22 PM
Last Post: snippsat
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,225 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  Virtual environment path? Led_Zeppelin 1 2,315 Jul-22-2021, 01:40 PM
Last Post: snippsat
  virtual environment heye 4 2,492 Jul-04-2021, 06:47 AM
Last Post: ndc85430
  import statement in a virtual environment leodavinci1990 1 2,380 Mar-04-2021, 12:57 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020