Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error raised in virtualenv - dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.4/Python

I have the following scenario in my virtualenv.

after activating my virtualenv env-trails_dj with

source env-trails_dj/bin/activate

and try to launch python, I get the following error:

(env-trails_dj) AirTime:trails_dj udos$ python
dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.4/Python
  Referenced from: /Users/udos/PycharmProjects/trails_dj/env-trails_dj/bin/python
  Reason: image not found
Trace/BPT trap: 5

the virtualenv PATH looks as following:

(env-trails_dj) AirTime:trails_dj udos$ echo $PATH
/Users/udos/PycharmProjects/trails_dj/env-trails_dj/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

I checked the following directory but it is empty...

(env-trails_dj) AirTime:trails_dj udos$ ls -al /Library/Frameworks/Python.framework/Versions/
total 0
drwxrwxr-x  2 root  wheel   68 Jul 13 10:58 .
drwxr-xr-x  6 root  wheel  204 Jul 13 10:43 ..

maybe just a reference which is missing but I was unable to identify

note: not sure what has caused this. maybe the upgrade to OS X El Capitan (10.11.1).

update:

(env-trails_dj) AirTime:trails_dj udos$ ls -la /Users/udos/PycharmProjects/trails_dj/env-trails_dj/bin/
total 248
drwxr-xr-x  16 udos  staff    544 Sep 22 22:13 .
drwxr-xr-x   8 udos  staff    272 Oct 23 16:40 ..
drwxr-xr-x   3 udos  staff    102 Sep 11 20:26 __pycache__
-rw-rw-r--   1 udos  staff   2185 Sep 13 16:36 activate
-rw-rw-r--   1 udos  staff   1301 Sep 11 20:25 activate.csh
-rw-rw-r--   1 udos  staff   2437 Sep 11 20:25 activate.fish
-rwxr-xr-x   1 udos  staff    312 Sep 11 20:26 django-admin
-rwxr-xr-x   1 udos  staff    171 Sep 11 20:26 django-admin.py
-rwxr-xr-x   1 udos  staff    279 Sep 12 09:07 easy_install
-rwxr-xr-x   1 udos  staff    279 Sep 12 09:07 easy_install-3.4
-rwxr-xr-x   1 udos  staff    251 Sep 12 09:05 pip
-rwxr-xr-x   1 udos  staff    251 Sep 12 09:05 pip3
-rwxr-xr-x   1 udos  staff    251 Sep 12 09:05 pip3.4
-rwxr-xr-x   1 udos  staff  25920 Sep 11 20:25 python
-rwxr-xr-x   1 udos  staff  25920 Sep 11 20:25 python3
-rwxr-xr-x   1 udos  staff  25920 Sep 11 20:25 python3.4

checking which python version is launched:

env-trails_dj) AirTime:trails_dj udos$ which python
/Users/udos/PycharmProjects/trails_dj/env-trails_dj/bin/python

based on the error, python is looking in another directory:

(env-trails_dj) AirTime:trails_dj udos$ python
dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.4/Python
  Referenced from: /Users/udos/PycharmProjects/trails_dj/env-trails_dj/bin/python
  Reason: image not found
Trace/BPT trap: 5

update_2:

(env-trails_dj) AirTime:trails_dj udos$ pip install Python
dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.4/Python
  Referenced from: /Users/udos/PycharmProjects/trails_dj/env-trails_dj/bin/python
  Reason: image not found
Trace/BPT trap: 5
like image 577
udo Avatar asked Feb 06 '26 13:02

udo


1 Answers

It looks like your Python framework installed incorrectly or removed. Your virtual environment looks for symlinked python file in /Library/Frameworks/Python.framework/Versions/3.4/Python. You can make sure about this by entering ls -la /Users/udos/PycharmProjects/trails_dj/env-trails_dj/bin — there should be a link to your Python install.

Try to reinstall Python from scratch, and then use: /Library/Frameworks/Python.framework/Versions/3.4/python -m venv ~/PycharmProjects/<newVirtualEnv> to make new environment or try the existing one.

like image 188
Alex Bogomolov Avatar answered Feb 09 '26 08:02

Alex Bogomolov